| ||||||||||
| 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 | |||||||||
求助:1006大牛们给点Hint吧
代码:
#include <iostream>
using namespace std;
int main()
{
int p=0,i=0,e=0,d=0,l=0,n=0;
while((cin>>p>>e>>i>>d)&&(p!=-1))
{
n++;
p=p%23;e=e%28;i=i%33;
l=((d+32)/33)*33+i;
bool found=false;
if(l==d) l=33+d;
while(!found)
{
if((l%23==p)&&(l%28)==e) found=true;
else l+=33;
}
cout<<"Case "<<n<<": the next triple peak occurs in "<<l-d<<" days."<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator