| ||||||||||
| 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 | |||||||||
我测试的数据都对但是,提交的时候就是不行...高手帮帮忙......c++的.#include "stdafx.h"
#include <iostream.h>
int main()
{long int p,e,i;
int key=0,d[50];
int n=21252,sum[50];
while(1)
{ key++;
cin>>p>>e>>i>>d[key];
if((p==e)&&(e==i)&&(i==d[key])&&(d[key]==-1))
break;
if((p==e)&&(e==i))
{sum[key]=n+p;}
else{while((p!=e)||(e!=i))
{if(p<=e&&p<=i)p=p+23;
else if(e<=p&&e<=i)
e=e+28;
else if((i<=p)&&(i<=e))
i=i+33;
}
sum[key]=p;
}
}
for(i=1;i<key;i++)
{if(sum[i]-d[i]>n)
cout<<"Case"<<i<<": the next triple peak occurs in "<<((sum[i]-d[i])%n)<<" days."<<endl;
else
cout<<"Case "<<i<<": the next triple peak occurs in "<<sum[i]-d[i]<<" 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