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

请高手帮忙看看,我对那些变态数据都测试过了,为什么还是WA?

Posted by chygr at 2007-09-25 18:19:16 on Problem 1006
#include<iostream>
using namespace std;

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