| ||||||||||
| 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 | |||||||||
能不能给多一些容易出错的数据,我的不知道为什么wrong answer??#include<fstream.h>
long peak(int p,int e,int i,int d){
int l;
long x=0;
l=(d-p)/23+1;
l=1>l?1:l;
for(;x<21252;l++){
x=23*l+p-d;
if((23*l+p-e)%28==0)
if((23*l+p-i)%33==0)
return x;
}
return 21252;
}
int main()
{
int p,e,i,d,n=1;
ifstream fin;
fin.open("in.txt");
while(fin>>p,fin>>e,fin>>i,fin>>d,p>-1&&e>-1&&i>-1){
cout<<"Case "<<n<<": the next triple peak occurs in "<<peak(p,e,i,d)<<" days."<<endl;
n++;
}
fin.close();
return 1;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator