| ||||||||||
| 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 | |||||||||
HELP 总说程序超时,帮忙改进一下算法,谢谢拉...#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator