Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:为什么是Time Limit Exceeded?帮帮忙看一下,谢谢!

Posted by GYP at 2006-04-21 13:19:38 on Problem 1969
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator