| ||||||||||
| 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 | |||||||||
帮我看下!我的现在能调试出来但是提交不成功!!为啥啊?帮我看看!!谢谢!#include <iostream.h>
int f(int t)
{
int count=1;
lable:if(t==1)
return count;
if(t%2!=0)
t=3*t+1;
else
t=t/2;
count++;
goto lable;
}
void main(void)
{
int a1,a2,s1,s2,min,max,temp;
while(cin>>a1>>a2)
{
max=(a1>a2?a1:a2);
min=a1+a2-max;
s1=f(min);
s2=f(min+1);
temp=(s1>s2?s1:s2);
while(min+2<max)
{
min++;
if(temp<f(min+1)) temp=f(min+1);
}
cout<<a1<<" "<<a2<<" "<<temp<<endl;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator