Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

所有的例程输出都正确呀,这个错到到哪了??

Posted by iambocai at 2010-08-24 21:09:48 on Problem 1006
#include <iostream>
using namespace std;

int main(){
    int p,e,i,d,pe,temp,res;
    int cnt = 1;
    while(1){
        cin>>p>>e>>i>>d;
        if(p==-1&&e==-1&&i==-1&&d==-1){
            return 0;
        }
        p=p%23; e=e%28; i=i%33; 
        temp=1;
        while(1){
            while((e-p+temp*5)%23!=0)
                temp++;
            pe = e+28*temp;
            if((pe-i)%33!=0){
                temp++;
                continue;
            }
            else break;
        }
        pe-d>0? res=pe-d:res=pe-d+21252;
        cout<<"Case "<<cnt<<": the next triple peak occurs in "<<res<<" days."<<endl;
        cnt++;
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator