标签:
3 1 0
5 0
1 #include <cstdio> 2 #include <cstdlib> 3 4 int main(int argc, char const *argv[]) 5 { 6 int n; 7 scanf("%d",&n); 8 while(n != 0) { 9 int ans = 0; 10 while(n != 1) { 11 if(n %2 == 0) { 12 n = n/2; 13 } 14 else { 15 n = 3 * n + 1; 16 n = n/2; 17 } 18 ans++; 19 } 20 printf("%d\n",ans); 21 scanf("%d",&n); 22 } 23 return 0; 24 }
3 3 8 4 5 3 8 4 7 15 5 3 8 4 15 7 0
3 15 7 3 7 15 3
九度oj 题目1031:xxx定律 题目1033:继续xxx定律
标签:
原文地址:http://www.cnblogs.com/jasonJie/p/5688304.html