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

请问这题思路是什么啊?不是穷举吗?我怎么错了。。。

Posted by zsjzfeng at 2004-08-04 20:58:42 on Problem 1006
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:
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