| ||||||||||
| 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 | |||||||||
16MS#include <stdio.h>
int main()
{
int p,e,i,d,k1;
int icase=1;
while(icase)
{
scanf("%d %d %d %d",&p,&e,&i,&d);
if(p==-1&&e==-1&&e==-1&&d==-1) break;
k1 = (21*p-10*i-11*e)*13;
k1 %= 33;
if(k1<0) k1+=33;
k1=k1*28+11*(e-p);
k1 = 23*k1+p-d;
while(k1<=0) k1+=21252;
while(k1>21252)k1-=21252;
printf("Case %d: the next triple peak occurs in %d days.\n",icase,k1);
icase ++;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator