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 |
这样的代码也会wrong answer,天哪!不就是模拟么?难道不对? #include <stdio.h> int main() {long count,max; long i,t,a,b; while (scanf("%ld %ld",&a,&b)==2) {max=0; for (i=a;i<=b;i++) {t=i; count=0; for (;;) {count++; if (t==1) break; if (t%2==1) t=3*t+1; else t=t/2; } if (max<count) max=count; } printf("%ld %ld %ld\n",a,b,max); } return 1; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator