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 1213 at 2013-04-07 20:26:18 on Problem 1006
program trunc123(input,output);
var
  a,b,c,d,i,j,k,n,m:longint;
begin
  assign(input,'Biorhythms.in');
  assign(output,'Biorhythms.out');
  reset(input);
  rewrite(output);

  readln(a,b,c,d);n:=1;
  while (a<>-1)or(b<>-1)or(c<>-1)or(d<>-1) do
    begin
      if (a=b)and(b=c) then
        begin
          m:=a+21252-d;
          writeln('Case ',n,': the next triple peak occurs in ',m,' days.');
        end
      else
        begin
          while not((a=b)and(b=c)) do
            begin
              while a<c do a:=a+23;
              while b<c do b:=b+28;
              while c<a do c:=c+33;
              while b<a do b:=b+28;
              while a<b do a:=a+23;
              while c<b do c:=c+33;
            end;
          m:=a-d;
          m:=m mod 21252;
          if m=0 then m:=21252;
          writeln('Case ',n,': the next triple peak occurs in ',m,' days.');
        end;
      inc(n);
      readln(a,b,c,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