记录编号 1930 评测结果 AWWAWAAAAA
题目名称 到天宫做客 最终得分 70
用户昵称 GravatarHamster 是否通过 未通过
代码语言 Pascal 运行时间 10.000 s
提交时间 2008-09-10 14:04:11 内存使用 0.00 MiB
显示代码纯文本
program heaven;
const
  month:array[1..12] of real=(31,29,31,30,31,30,31,31,30,31,30,31);
var
  a:array[1..366] of integer;
  n,i,j,x,y,t:integer;
  ss,xx,s,yy:real;
  fin,fout:text;

procedure jian(q:integer);
var
  i:integer;
begin
  xx:=0;
  for i:=1 to (a[q] div 100)-1 do xx:=xx+month[i];
  xx:=xx+(a[q] mod 100);
end;

begin
  assign(fin,'heaven.in');
  reset(fin);
  assign(fout,'heaven.out');
  rewrite(fout);

  readln(fin,n);
  ss:=0;
  for i:=1 to n do
  begin
    readln(fin,x,y);
    a[i]:=100*x+y;
  end;
  for i:=1 to n-1 do
    for j:=n downto i+1 do
    begin
      if (a[i] div 100)>(a[j] div 100) then
      begin
        t:=a[i];
        a[i]:=a[j];
        a[j]:=t;
      end
      else
      if (a[i] div 100)=(a[j] div 100) then
        if a[i]>a[j] then
        begin
          t:=a[i];
          a[i]:=a[j];
          a[j]:=t;
        end;
    end;
  s:=0;
  for i:=1 to (a[1] div 100)-1 do s:=s+month[i];
  s:=s+(a[1] mod 100);
  yy:=s;
  for i:=2 to n do
  begin
    jian(i);
    ss:=xx-yy;
    yy:=xx;
    if ss>s then s:=ss;
  end;
  if s<366-xx then s:=366-xx;
  s:=s-1;
  writeln(fout,s/366*24*3600:0:0);

  close(fin);
  close(fout);
end.