| ||||||||||
| 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 | |||||||||
请问这题思路是什么啊?不是穷举吗?我怎么错了。。。var
i,j,k,l:longint;
a:array[1..4] of longint;
begin
k:=0;
l:=0;
repeat
inc(k);
readln(a[1],a[2],a[3],a[4]);
if a[1]<>-1 then begin
for i:=1 to 21252 do if ((i-a[1])mod 23=0)and((i-a[2])mod 28=0)and((i-a[3])mod 33=0) then begin
l:=1;
writeln('Case ',k,': the next triple peak occurs in ',i-a[4],' days.');
break;
end;
end;
until (a[1]=-1)and(a[2]=-1)and(a[3]=-1)and(a[4]=-1);
end.
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator