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

Re:不可能不对呀?WA 有高手吗

Posted by tszcgf at 2008-07-22 21:47:48 on Problem 1006
In Reply To:不可能不对呀?WA 有高手吗 Posted by:UESTCCommunication at 2008-04-07 14:18:26
结果可能是负的呀.
#include<stdio.h>

int main()
{
    int a,b,c,d,x,i;
    for(i=1;;i++){x=0;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(a == -1 && b == -1 && c == -1 && d== -1) break;
     a=a%23,b=b%28,c=c%33;

    for(x=0;;x++)
      if(x%23 == a && x%28 == b && x%33 == c)  break;

    x=x-d;
    if(x<=0)x=x+21252;
    printf("Case %d: the next triple peak occurs in %d days.\n",i,x);
} 
}

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