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:帮帮忙!!!第1006 wrong answer

Posted by 3sandejiu at 2009-04-30 23:03:46
Program p1006;
Const
  infile = 'p1006.in';
  outfile = 'p1006.out';
Var
  n, p, e, i, d, j: Longint;
Begin
  Assign(input, infile);
  Assign(output, outfile);
  Reset(input);
  Rewrite(output);
  n:=0;
  Readln(p, e, i, d);
  While not ((p=-1) and (e=-1) and (i=-1) and (d=-1)) Do Begin
    Inc(n);
    For j:=0 To 644 Do
      If (i+33*j-p>=0) and (i+33*j-e>=0) and ((i+33*j-p) mod 23 = 0) and ((i+33*j-e) mod 28=0) Then Break;
    while i+33*j-d<=0 Do j:=j+644;
    Writeln('Case ', n, ': the next triple peak occurs in ', i+33*j-d, ' days.');
    Readln(p, e, i, d);
  End;
  Close(input);
  Close(output);
End.

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