| ||||||||||
| 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 | |||||||||
<PASCAL> why wa?program pku1006;
var aa,nn:array[1..3] of integer;
count,i,s,day:integer;
function euc(a,b:longint;var x,y:longint):longint;
var t:longint;
begin
if b=0 then
begin
euc:=a;x:=1;y:=0;
end
else
begin
euc:=euc(b,a mod b,x,y);
t:=x;x:=y;y:=t-(a div b)*y;
end;
end;
procedure china;
var d,x,y,n,m,i,a:longint;
begin
n:=21252;
a:=0;
for i:=1 to 3 do begin
m:=n div nn[i];
d:=euc(nn[i],m,x,y);
a:=a+m*((y*aa[i])mod n);
end;
while a<=0 do a:=a+n;
while a>n do a:=a-n;
writeln('Case ',count,': the next triple peak occurs in ',a-day,' days.');
end;
begin
nn[1]:=23;
nn[2]:=28;
nn[3]:=33;
count:=0;
repeat
inc(count);
readln(aa[1],aa[2],aa[3],day);
s:=0;
for i:=1 to 3 do s:=s+aa[i];
if (s<>-3) and (day<>-1) then china;
until s=-3;
end.
用的解模线形方程组的方法 谁知道为什么WA? 测试数据都对
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator