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

HELP 总说程序超时,帮忙改进一下算法,谢谢拉...

Posted by 90405126 at 2004-11-12 10:52:20 on Problem 1006
#include<stdio.h>
#include<math.h>
void main(){
	int i,a,b,c,d,j,s[10],k;
	for(j=0;j<=1000;j++)
    { scanf("%d %d %d %d",&a,&b,&c,&d);
	  if(a==-1,b==-1,c==-1,d==-1)break;
	  for(i=1;i<=21252;i++)
	  {if((i+d-a)%23==0)
	     if((i+d-b)%28==0)    
	        if((i+d-c)%33==0)
			  s[j]=i;
	  }
	}
	for(k=0;k<=j-1;k++){
		  printf("Case %d: the next triple peak occurs in %d days.\n",k+1,s[k]);
	}
}

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