比赛 |
NOIP_2 |
评测结果 |
AAAWAAWWWA |
题目名称 |
到天宫做客 |
最终得分 |
60 |
用户昵称 |
maxiem |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2008-09-08 21:13:18 |
显示代码纯文本
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
i,a,b,max,n:integer;
t:array [0..1000] of 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+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.