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:为什么是Time Limit Exceeded?帮帮忙看一下,谢谢!In Reply To:为什么是Time Limit Exceeded?帮帮忙看一下,谢谢! Posted by:1323456789 at 2005-01-10 13:06:38 > #include<stdio.h> > #include<math.h> > void main(){ > int a,b,t,s, k; > scanf("%d",&t); > while(t!=0){ > if(t==1)printf("TERM %d IS %d/%d\n",1,1,1); > if(t==2)printf("TERM %d IS %d/%d\n",2,1,2); > for(a=1;a<t;a++){ > for(b=1;b<t;b++){ > > if((a+b)%2==1){s=a; > for(k=1;k<(a+b-1);k++){ > s+=k; > } > if(s==t) printf("TERM %d IS %d/%d\n",t,a,b); > > } > else{s=b; > for(k=1;k<(a+b-1);k++){ > s+=k; > > } > if(s==t) printf("TERM %d IS %d/%d\n",t,a,b); > > > > } > > } > > } > scanf("%d",&t); > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator