| ||||||||||
| 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>
using namespace std;
int main()
{
int p,e,i,d,x,n,s;
cin>>p>>e>>i>>d;
n=1;
while(!(p==-1&&e==-1&&i==-1&&d==-1))
{
s=p; if(s>e) s=e; if(s>i) s=i; if(s>d) s=d;
p=p-s; e=e-s; i=i-s; d=d-s;
if(p==0&&e==0&&i==0)
x=21252-d;
else
{
x=i;
if (i==0)
x=+33;
while(!((x-p)%23==0&&(x-e)%28==0))
x+=33;
x=x-d;
}
if(x>21252) x=-21252;
if(x<0) x=+21252 ;
cout<<"Case "<<n<<": the next triple peak occurs in "<<x<<" days."<<endl;
n++;
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