比赛 NOIP_2 评测结果 AWWAWAAAAA
题目名称 到天宫做客 最终得分 70
用户昵称 dingding 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-09-08 20:19:27
显示代码纯文本
program heaven;
const
   date:array[1..12] of longint=(31,29,31,30,31,30,31,31,30,31,30,31);
var
   x,y,i,j,n,max:longint;
   b:array[1..12,1..31] of longint;
   c:array[1..366] of longint;
   f:text;
   yon:boolean;
procedure chushi;
begin
   i:=1; x:=1; y:=1;
   b[x,y]:=i;
   while i<=365 do begin
   i:=i+1; y:=y+1;
   if y>date[x] then begin x:=x+1; y:=1; end;
   b[x,y]:=i;
   end;
end;
begin
   chushi;
   assign(f,'heaven.in');
   reset(f);
   readln(f,n);
   for i:=1 to n do begin
   readln(f,x,y);
   c[i]:=b[x,y];
   end;
   close(f);
   repeat
   yon:=false;
   for i:=1 to n-1 do
   if c[i]>c[i+1] then begin x:=c[i]; c[i]:=c[i+1]; c[i+1]:=x; yon:=true; end;
   until not(yon);
   max:=0;
   for i:=1 to n-1 do begin
   x:=c[i+1]-c[i]-1;
   if x>max then max:=x;
   end;
   max:=round(max*3600*24/366);
   assign(f,'heaven.out');
   rewrite(f);
   writeln(f,max);
   close(f);
end.