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 kkmmnn at 2006-10-02 17:12:18 on Problem 1006
#include<iostream>
using namespace std;
int main()
 {
    int p,e,i,d,x,n,s;
    cin>>p>>e>>i>>d;
    n=1;
    while(!(p==-1&&e==-1&&i==-1&&d==-1))
    {
       s=p; if(s>e) s=e; if(s>i) s=i; if(s>d) s=d;
       p=p-s; e=e-s; i=i-s; d=d-s;
       if(p==0&&e==0&&i==0)
        x=21252-d;
       else
        {
           x=i;
         if (i==0)
          x=+33;
          while(!((x-p)%23==0&&(x-e)%28==0))
           x+=33;
           x=x-d;
           }    
         if(x>21252) x=-21252;
         if(x<0) x=+21252 ;
          cout<<"Case "<<n<<": the next triple peak occurs in "<<x<<" days."<<endl;
          n++;
         cin>>p>>e>>i>>d; 
         }
       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