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呢???哪位帮我看看????即使是去掉!EOF,为什么会是TLE呢??#include<stdio.h> int jud(int n) { int i=1; while(n!=1) { if(n%2==0) n=n/2; else n=3*n+1; i++; } return i; } int main() { int i; int m,n,t; while(scanf("%ld %ld",&m,&n)!=EOF) { if(m>n) { for(i=n;i<=m;i++) { if(jud(i)>t) t=jud(i); } } for(i=m;i<=n;i++) { if(jud(i)>t) t=jud(i); } printf("%d %d %d\n",m,n,t); t=0; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator