| ||||||||||
| 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 | |||||||||
为什么总是output limit exceed呢?????#include<stdio.h>
#include<math.h>
void main(){
long int i,j,k,count,max,t;
scanf("%d%d",&i,&j);
while(i>0&&j>0&&i<10000&&j<10000){
max=0;
for(k=i;k<=j;k++){
count=1;
t=k;
while(t!=1){
if(t%2==1) t=3*t+1;
else t=t/2;
count++;
}
if(count>max) max=count;
}
printf("%d %d %d\n",i,j,max);
scanf("%d%d",&i,&j);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator