| ||||||||||
| 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>
using namespace std;
int main()
{ int p,e,i,d;
cin>>p>>e>>i>>d;
int k[10000];
int j=0;
while(p>=0&&p<365&&e>=0&&e<365&&i>=0&&i<365&&d>=0&&d<365&&p!=-1&&e!=-1&&i!=-1&&d!=-1)
{
int s=i;
while(1)
{
s+=33;
if((s-e)%28==0&&(s-p)%23==0)break;
}
k[j]=s-d;
if(k[j]>21252)k[j]=k[j]%21252;
j++;
cin>>p>>e>>i>>d;
}
for(int h=0;h<j;h++)
cout<<"Case "<<h+1<<": "<<"the next triple peak occurs in "<<k[h]<<" 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