| ||||||||||
| 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 | |||||||||
为什么所有BT的数据我都已经过了,却还是WA呢?????(附有代码和BT数据)#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int p, e, i, d, n=1, res=0;
int main()
{
while(scanf("%d%d%d%d",&p, &e, &i, &d))
{
int j;
if(p==-1)
break;
p%=23;
e%=28;
i%=33;
for(j=p+1; (j-p)%23; j++);
for(; (j-e)%28; j+=23);
for(; (j-i)%33; j+=23*28);
res=j-d;
res%=21252;
if(res==0)
res=21252;
printf("Case %d: the next triple peak occurs in %d days.\n",n,res);
n++;
}
return 0;
}
/*
0 4 5 0
2 2 2 2
123 128 133 1
123 128 133 100
0 1 2 1
1 0 2 1
1 2 0 1
1 2 3 0
117 58 2 27
24 29 34 0
24 29 34 1
24 29 34 2
0 0 0 0
*/
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator