| ||||||||||
| 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题#include<iostream>
using namespace std;
int main()
{
int p,e,i,d;
int p1,e1,i1,n=1;
cin>>p>>e>>i>>d;
while(p!=-1||e!=-1||i!=-1||d!=-1)
{
if(p<0||e<0||i<0||d<0||p>365||e>365||i>365||d>365)
{
cout<<"wrong input"<<endl;
}
else
{
p1=p%23;
e1=e%28;
i1=i%33;
for(int k=1;;k++)
{
if(k%23==p1&&k%28==e1&&k%33==i1)
{
cout<<"Case "<<n<<": the next triple peak occurs in "<<k-d<<" days."<<endl;
n++;
break;
}
}
}
cin>>p>>e>>i>>d;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator