Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
WA...求大牛神解。#include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> int main() { int i,a,b,t,n,m,max,count; while(scanf("%d%d",&a,&b)!=EOF) { n=a; m=b; if(a>b) t=a,a=b,b=t; for(i=a;i<=b;i++) { t=i; for(count=1;t>1;count++) { if(t%2==0) t/=2; else t=t*3+1; } if(count>max) max=count; } printf("%d %d %d\n",n,m,max); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator