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> int main() { int n,m,t; int i,max,k,c1,c2,flag; while(scanf("%d %d",&n,&m)!=EOF) {c2=0;flag=0; if(n>m) { t=n;n=m;m=t; flag=1; } for(i=n;i<m;i++) {c1=1;k=i; while(k!=1) { if(k%2==0) k=k/2; else k=3*k+1; c1++; } if(c1>c2) { c2=c1; } } if(flag==1) { t=n;n=m;m=t; } printf("%d %d %d\n",n,m,c2); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator