| ||||||||||
| 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:qsr10250030 at 2006-11-01 18:51:40 > #include<iostream>
> #include<conio.h>
> using namespace std;
> int main(){
> int i=1,j=1;
> int x,y,a,b;
> cin>>x>>y;
> a=x;b=y;
> while(x!=1)
> if(x%2==0) {x/=2;i++;}
> else {x=3*x+1;i++;}
> while(y!=1)
> if(y%2==0) {y=y/2;j++;}
> else {y=3*y+1;j++;}
> if(i>=j)
> cout<<a<<" "<<b<<" "<<i<<endl;
> else
> cout<<a<<" "<<b<<" "<<j<<endl;
> getch();
> return 0;}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator