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 bage at 2010-12-03 17:08:46 on Problem 1006
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:
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