记录编号 |
1995 |
评测结果 |
AAAAAAAAAA |
题目名称 |
到天宫做客 |
最终得分 |
100 |
用户昵称 |
lc |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.035 s |
提交时间 |
2008-09-10 20:26:09 |
内存使用 |
0.11 MiB |
显示代码纯文本
program day2_1;
const
month:array[1..12] of integer=(31,29,31,30,31,30,31,31,30,31,30,31);
var
tmp,ans:integer;
a,b:array[0..369] of integer;
n,i,j:integer;
procedure swap(var a,b:integer);
var
temp:integer;
begin
temp:=a;
a:=b;
b:=temp
end;
function suan(a1,b1,a2,b2:integer):integer;
var
i,tmp:integer;
begin
if (a1=a2) and (b1=b2) then exit(0);
if a1=a2
then exit(b2-b1-1)
else
begin
tmp:=month[a1]-b1;
for i:=a1+1 to a2-1 do
inc(tmp,month[i]);
inc(tmp,b2-1);
exit(tmp);
end;
end;
begin
assign(input,'heaven.in');
assign(output,'heaven.out');
reset(input); rewrite(output);
read(n);
for i:=1 to n do
read(a[i],b[i]);
for i:=1 to n-1 do
for j:=i+1 to n do
if (a[i]>a[j]) or (a[i]=a[j]) and (b[i]>b[j])
then
begin
swap(a[i],a[j]);
swap(b[i],b[j]);
end;
inc(n);
a[0]:=1; b[0]:=0;
a[n]:=12; b[n]:=32;
for i:=0 to n-1 do
begin
tmp:=suan(a[i],b[i],a[i+1],b[i+1]);
if tmp>ans
then ans:=tmp
end;
writeln(round(ans/366*24*3600));
close(input); close(output);
end.