| ||||||||||
| 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。其实暴力也很快,一个case也就算1000次而已~~#include <iostream>
using namespace std;
int main()
{
int p, e, i, d, k, c=0;
while(cin>>p>>e>>i>>d && p!=-1)
{
c++;
p%=23; e%=28; i%=33;
if(p==e && e==i && p>d)
k=1;
else do
{
p+=23;
k=p;
}while(d>=k || (p-e)%28 || (p-i)%33);
cout<<"Case "<<c<<": the next triple peak occurs in "<<k-d<<" days."<<endl;
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator