记录编号 1871 评测结果 AAAAAAAAAA
题目名称 到天宫做客 最终得分 100
用户昵称 Gravatarmaxiem 是否通过 通过
代码语言 Pascal 运行时间 0.002 s
提交时间 2008-09-09 14:15:07 内存使用 0.11 MiB
显示代码纯文本
program heaven;
type node=record
  m,d:byte;
end;
const
  months:array [1..12] of byte=(31,29,31,30,31,30,31,31,30,31,30,31);
var
  j,i,a,b,max,n:integer;
  t:array [0..1000] of node;
  tmp:node;
  days:array [0..365] of integer;
  s:longint;
begin
  s:=0;max:=-maxint;
  fillchar (days,sizeof(days),0);
  assign (input,'heaven.in');
  reset (input);
  readln (n);
  for i:=1 to n do readln (t[i].m,t[i].d);
  t[0].m:=1;t[0].d:=0;
  t[n+1].m:=12;t[n+1].d:=32;
  for i:=1 to n do for j:=i+1 to n do if t[i].m>t[j].m then begin
    tmp:=t[i];
    t[i]:=t[j];
    t[j]:=tmp;
  end
  else begin
    if (t[i].m=t[j].m) and (t[i].d>t[j].d) then begin
      tmp:=t[i];
      t[i]:=t[j];
      t[j]:=tmp;
    end;
  end;
  for i:=1 to n+1 do begin
    inc(days[0]);
    for a:=t[i-1].m to t[i].m-1 do days[days[0]]:=days[days[0]]+months[a];
    b:=1;while b<t[i].d do begin
      inc(days[days[0]]);
      inc(b);
    end;
    dec(days[days[0]],t[i-1].d);
  end;
  for i:=1 to days[0] do if days[i]>max then max:=days[i];
  close (input);
  assign (output,'heaven.out');
  rewrite (output);
  s:=trunc((max*86400)/366+0.5);
  writeln (s);
  close (output);
end.