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 legendry at 2015-04-25 23:14:15 on Problem 1006
#include<iostream>
#include<cstdio>
using namespace std;
int p,e,i,d,n;
int main()
{
    int j=0;
    while(scanf("%d%d%d%d",&p,&e,&i,&d)==4&&(p+e+i+d)!=-4)
    {
        j++;
        n=i;
        while(n<=21252+d)
        {
            if(n<=d){
                n=n+33;
                continue;
            }
            else if((n-p)%23==0&&(n-e)%28==0){
                break;
            }
            else n=n+33;
        }
        printf("Case %d: the next triple peak occurs in %d days.\n",j,n-d-21252>0?(n-d)%21252:(n-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