| ||||||||||
| 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 | |||||||||
帮忙给看看吧!#include <iostream.h>
#include <stdlib.h>
void main()
{
int p,e,i,d,count=1,t;
cin>>p>>e>>i>>d;
if(p>365||e>356||i>365||d>365||p<0||e<0||i<0||d<0)
exit(0);
while(p!=-1&&e!=-1&&i!=-1&&d!=-1)
{
p=p%365;e=e%365;i=i%365;
t=23;
if(t<p)
t=p+1;
while((t-p)%23!=0)
{t++;}
while((t-e)%28!=0)
t=t+23;
while((t-i)%33!=0)
t=t+23*28;
t=t-d;
if(t<=0)
t=t+21252;
if(t>21252)
t=t%21252;
cout<<"Case "<<count<<": the next triple peak occurs in "<<t<<" days."<<endl;
count++;
cin>>p>>e>>i>>d;
if(p>365||e>356||i>365||d>365||p<0||e<0||i<0||d<0)
exit(0);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator