| ||||||||||
| 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 | |||||||||
居然超时了~~哪个帮看一下#include<stdio.h>
int main()
{
int p;
int e;
int i;
int d;
int k;
int a[100]={0};
int j=0;
int m;
int n;
scanf("%d %d %d %d",&p,&e,&i,&d);
while((p!=-1)&&(e!=-1)&&(i!=-1)&&(d!=-1))
{
p=p%23;
e=e%28;
i=i%33;
for(k=1;k<=21252;k++)
{
n=k+d;
if((n%23==p)&&(n%28==e)&&(n%33==i))
{
a[j++]=k;
break;
}
}
scanf("%d %d %d %d",&p,&e,&i,&d);
}
for(m=0;m<j;m++)
{
printf("Case ");
printf("%d",m+1);
printf(": the next triple peak occurs in ");
printf("%d",a[m]);
printf(" days.\n");
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator