UVa 100 3n+1 Problem
摘要:
1 #include <stdio.h> 2 #define MAXN 1000000 3 int a[MAXN] = { 0, 1, 2 }; 4 int getCycleLength(long long n) 5 { 6 if (n < MAXN && !a[n]) 7 return a[n] = getCycleLength(((n & 1) == 0) ? (n >> 1) : (3 * n + 1)) + 1; 8 else 9 if(n >= MAXN)10 return overBoundry(n);11 ... 阅读全文
posted @ 2013-04-26 15:12 Raphael_W 阅读(104) 评论(0) 推荐(0) 编辑