| ||||||||||
| 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 | |||||||||
输入200个case你怎么办?1000个呢?In Reply To:Run Time Error??????Why???Who can tell me??? Prob 1006 Posted by:Ceoalpha at 2006-03-24 19:59:49 > #include<iostream>
> using namespace std;
>
> int max(int i, int j)
> {
> if(i>=j)
> return i;
> else return j;
> }
>
> void main()
> {
> int p[100],e[100],i[100],d[100];
> int ans;
> long int day;
> int cnt=0;
> bool flag=true;
> while(flag)
> {
> cin>>p[cnt]>>e[cnt]>>i[cnt]>>d[cnt];
> if(p[cnt]==-1 && e[cnt]==-1 && i[cnt]==-1 && d[cnt]==-1)
> flag=false;
> cnt++;
> }
>
> for(int j=0;j<cnt-1;j++)
> {
> day=p[j];
> flag=true;
> for(int k = max(max(max(p[j],e[j]), i[j])+1, 23); ;k++)
> {
> if(((k - p[j])%23 == (k - e[j])%28) && ((k-p[j])%23 == (k-i[j]) % 33)) {
> day=k;
> break;
> }
> }
>
> ans=day-d[j];
> cout<<"Case "<<j+1<<": the next triple peak occurs in "<<ans<<" days."<<endl;
> }
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator