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

Re:优化后AC了……

Posted by 568082880 at 2015-05-11 08:40:04 on Problem 1006
In Reply To:为什么我把C++翻译过来后超时了?而C++能AC? Posted by:568082880 at 2015-05-11 08:06:38
var p,e,i,d,x,k:longint;
begin
 while k=k do
  begin
   inc(k);
   readln(p,e,i,d);
   if (p=-1)and(e=-1)and(i=-1)and(d=-1) then
    break;
   for x:=d+1 to 21252 do
    if abs(x-p)mod 23=0 then
     break;
   while x<=21252 do
    begin
     if abs(x-e) mod 28=0 then
      break;
     inc(x,23);
    end;
   while x<=21252 do
    begin
     if abs(x-i) mod 33=0 then
      break;
     inc(x,23*28);
    end;
   writeln('Case ',k,': the next triple peak occurs in ',x-d,' days.');
  end;
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