| ||||||||||
| 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 | |||||||||
AC c++#include<cstdio>
int main()
{
int a,b,c,d,i,k=0;
while (1)
{
k++;
scanf("%d%d%d%d",&a,&b,&c,&d);
if (a==-1 && b==-1 && c==-1 &&d==-1) return 0;
i=1;
while (1)
{
if((i-a)%23==0 && (i-b)%28==0 &&(i-c)%33==0) break;
i++;
}
if(i<d) i+=23*28*33;
printf("Case %d: the next triple peak occurs in %d days.\n",k,i-d);
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator