| ||||||||||
| 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 | |||||||||
Re:求助大神看看我这代码哪里错了 我试了好多数都可以啊In Reply To:求助大神看看我这代码哪里错了 我试了好多数都可以啊 Posted by:littlehu at 2015-05-01 16:53:47 #include<iostream>
#include<math.h>
#include<vector>
using namespace std;
int main()
{
int p,e,i,d;
int time=1;
while(cin>>p>>e>>i>>d)
{
if(p==-1&&e==-1&&i==-1&&d==-1)
{
break;
}
if(d<0||d>=365)
{
break;
}
int m;
for(m=d;m<=21252;m++)
{
if(p==0&&e==0&&i==0&&d==0)
{
cout<<"case "<<time<<": the next triple peak occurs in "<<21252<<endl;
time++;
break;
}
if((m+d-p)%23==0&&(m+d-e)%28==0&&(m+d-i)%33==0)
{
cout<<"case "<<time<<": the next triple peak occurs in "<<m<<" days."<<endl;
time++;
break;
}
}
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator