| ||||||||||
| 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 | |||||||||
求助大神,为什么讨论里所有数据都能过,还是WA呢?#include<iostream>
#include<cstdio>
using namespace std;
int p,e,i,d,n;
int main()
{
int j=0;
while(scanf("%d%d%d%d",&p,&e,&i,&d)==4&&(p+e+i+d)!=-4)
{
j++;
n=i;
while(n<=21252+d)
{
if(n<=d){
n=n+33;
continue;
}
else if((n-p)%23==0&&(n-e)%28==0){
break;
}
else n=n+33;
}
printf("Case %d: the next triple peak occurs in %d days.\n",j,n-d-21252>0?(n-d)%21252:(n-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