| ||||||||||
| 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 | |||||||||
悲剧day后少了一个'.',WA了三次
var
p,e,i,d,t,total,j,g,h,x:longint;
a,b,k:array[1..3] of int64;
ji:int64;
begin
read(p,e,i,d);
{if (p=2)and(i-2)and(}
t:=23*28*33;
g:=1;
a[1]:=p mod 23;a[2]:=e mod 28;a[3]:=i mod 33;
b[1]:=23;
b[2]:=28;;b[3]:=33;
g:=1;
while (p<>-1)and(i<>-1)and(e<>-1)and(d<>-1) do
begin
total:=0;
for j:=1 to 3 do
begin
h:=t div b[j];
k[j]:=h;
while (k[j] mod b[j]<>a[j]) do k[j]:=k[j]+h;
end;
for j:=1 to 3do total:=total+k[j];
while (total>t)and(total>d) do total:=total-t;
ji:=total-d;
if ji<=0 then ji:=21252+ji;
writeln('Case ',g,': the next triple peak occurs in ',ji,' days.');
g:=g+1;
read(p,e,i,d);
a[1]:=p mod 23;a[2]:=e mod 28;a[3]:=i mod 33;
end;
end.
贴个水程
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator