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 RMJ87 at 2008-04-17 13:56:23 on Problem 1006
#include <iostream>
using namespace std;
int main()
{
    int p,e,i,d,day,w=0;
     while(1)
       {   cin>>p>>e>>i>>d;
           if(p==-1&&e==-1&&i==-1&&d==-1)
                   break;
            p=p%23;e=e%28;i=i%33;               
            for(day=1;day<=21252;day++)
               {
                 if((day+p)%23==0)
                        if((day+e)%28==0)
                             if((day+i)%33==0)
                                  {   ++w;       
                                     break;
                                  }
                 }       
            cout<<"Case "<<w<<": the next triple peak occurs in "<<day-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