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 hitcszw at 2006-12-04 13:44:24 on Problem 1006
#include<stdio.h>
int main()
{
    int p,i,e,d;
    int j,k;
    int max;
    k=1;
    scanf("%d %d %d %d",&p,&i,&e,&d);
    while(!(p==-1 && i==-1 && e==-1 && d==-1))
    {
        p=p%23;
        i=i%28;
        e=e%33;
        max=p;
        printf("%d %d %d %d\n",p,i,e,d);
        if(i>max) max=i;
        if(e>max) max=e;
        j=max;
        while(!((j-p)%23==0 && (j-i)%28==0 && (j-e)%33==0))
           j++;
    
        if(j>d) j=j-d;
        else
        if(j==d) j=21252;
        else
        if(j<d) j=j+21252-d;
        
        printf("Case %d: this next triple peak occurs in %d days.\n",k,j);
        k++;
        scanf("%d %d %d %d",&p,&i,&e,&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