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 radish at 2005-02-14 11:39:45 on Problem 1006
#include<iostream.h>
int main()
{
    int k,p,e,i,d,days;
    for(k=1;;k++)
    {
        cin>>p,cin>>e,cin>>i,cin>>d;
        if(p==-1)
        break;
        for(days=d+1;days<=21252;days++)
        {
            if((days-p%23)%23==0)
            if((days-e%28)%28==0)
            if((days-i%33)%33==0)
            break;
        }
        cout<<"Case "<<k<<": the next triple peak occurs in "<<days-d<<" days."<<endl;
    }        
    system("PAUSE");
    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