记录编号 1902 评测结果 AAAAAAAAAA
题目名称 到天宫做客 最终得分 100
用户昵称 GravatarWaterFire 是否通过 通过
代码语言 Pascal 运行时间 0.005 s
提交时间 2008-09-09 20:13:24 内存使用 0.63 MiB
显示代码纯文本
program waterfire;
const
fin='heaven.in';
fout='heaven.out';
month:array[1..12] of longint=(31,29,31,30,31,30,31,31,30,31,30,31);
 type
     tlist = array[0..367] of longint;

     var
n,s,s2,max,i,j:longint;
b: tlist;
data:array[0..366,0..366] of longint;
f,g:text;
procedure test(x,y:longint);
var
i,j:longint;
begin
for i:=1 to 12 do  begin
if x=i then begin
b[s]:=b[s]+y;
exit;
end;
if x<>i then
b[s]:=b[s]+month[i];
end;
end;
procedure  sort;
var
i,j:longint;

begin
for i:=n downto 1 do
 for j:=1 to i-1 do
  if b[j]>b[i] then begin
  b[0]:=b[i];b[i]:=b[j];b[j]:=b[0];
  end;
 end;

 procedure work;
 var
 i,j:longint;
 begin
 for i:=0 to n do
   if b[i+1]-b[i]-1>max then max:=b[i+1]-b[i]-1;

   max:=round(max/366*3600*24 );
  end;


    begin
data[0,1]:=1;data[0,2]:=1;
assign(f,fin);reset(f);
assign(g,fout);rewrite(g);
readln(f,n);
for i:=1 to n do
begin
for j:=1 to 2 do
read(f,data[i,j]);
s:=i;
test(data[i,1],data[i,2]);
 end;
 sort;
 b[0]:=0;
 b[n+1]:=367;
 work;
 write(g,max);
 close(g);
 close(f);
 end.