| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
求看为什么WAprogram 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator