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 rosachian at 2007-08-25 19:52:31 on Problem 1006
测试数据都是对的 但还是WA
#include"iostream"
using namespace std;
int max(int p,int e,int i)
{
    if(p>e){
        if(i<=e) return p;
        else if(p<i) return i;
             else return p;
           }
    else{
        if(p>i) return e;
        else if(e<i) return i;
             else return e;
         } 
}               
int main()
{
    int p,e,i,d;
    int k1,k2,k3;
    int k,j=0;
    while(scanf("%d%d%d%d",&p,&e,&i,&d)&&(p!=-1||e!=-1||i!=-1||d!=-1))
    {
        j++;
        k=max(p,e,i);
        //cout<<k;
        for(k1=k;k1<=924;k1++){
            k2=23*k1+p-e;
            k3=23*k1+p-i;
            if((k2%28==0)&&(k3%33==0)){
                if((k1==p)&&(k2/28==e)&&(k3/33==i))continue;
                else break;
            }
        }
        k=23*k1+p-d;
        if(k>21252) k=k%21252;
        cout<<"Case "<<j<<": the next triple peak occurs in "
            <<k<<" days."<<endl;
    }    
    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