| ||||||||||
| 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 | |||||||||
Re:哪位大哥看我那错了In Reply To:哪位大哥看我那错了 Posted by:crazyyangdan at 2011-05-30 14:25:02 > #include<iostream>
> using namespace std;
> int main()
> { int i,j,s,t;
> while(cin>>i>>j)
> { int m,n;
> m=(i<j)?i:j;
> n=(i>j)?i:j;
> for(int k=m;k<=n;k++)
> { t=s=0;
> while(k!=1)
> {
> if(k%2==0)
> k=k/2;
> else k=3*k+1;
> s=s+1;
> }
> if(s>t) t=s;
> }
> cout<<i<<" "<<j<<" "<<t<<endl;
> }
> system("pause");//去掉
> return 0;
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator