#include<stdio.h> int main() { int a,b; int n,m; int sum,count; int i; while(scanf("%d%d",&m,&n)!=EOF) { if(m>n) { a=n; b=m; } else {a=m; b=n; } sum=0; for(;a<=b;a++) { i=a; count=0; while(i!=1) { if(i%2==0) { count++; i=i/2; } else { count++; i=i*3+1; } } count++; if(sum<count)sum=count; } printf("%d %d %d\n",m,n,sum); sum=0; } return 0; }
pku 1207
原创
©著作权归作者所有:来自51CTO博客作者lizhaoze的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
PKU Babelfish
BabelfishTime Limit : 6000/3000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 11 Accepted Submission(s) : 8Problem DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you hav
acm/icpc hdu POJ #include i++ #define java