| ||||||||||
| 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 | |||||||||
虽然方法不先进,答案没问题啊 WAWAWA!!! Why?!#include"stdio.h"
int main()
{ int p, e, i, d, m=0;
while( scanf("%d %d %d %d",&p, &e, &i, &d) && ( (p+1) ||(e+1) ||(i+1) ||(d+1) ) )
{
int t,j;
if(d<0||d>364)
break;
m++;
p%=23; e%=28; i%=33;
for(j=1;j<=21252;j++)
{
if( (j%23==p) && (j%28==e) && (j%33==i) )
{ if(j<=d) {j++; continue;}
else {t=j-d; break;}
}
if(j==21252)
t=21252;
}
printf("Case %d: the next triple peak occurs in %d days.\n",m,t);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator