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 20071121181 at 2008-09-17 19:44:20 on Problem 1006
#include<iostream>
using namespace std;
int main()
{
    int p,q,r,i=0,j,a,b,c,d,S;
    while(cin>>p>>q>>r>>d)
    {
        if(p==-1&&q==-1&&r==-1&&d==-1)
        break;
        i++;
        if(p>=23)
        p=p%23;
        if(q>=28)
        q=q%28;
        if(r>=33)
        r=r%33;
        for(j=0;j<=644;j++)
        {
            S=j*33+r;
            if((S-p)%23==0&&(S-q)%28==0&&S>d)
            break;
        }               
        cout<<"Case "<<i<<": the next triple peak occurs in "
            <<S-d<<" 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