比赛 |
NOIP_2 |
评测结果 |
WWWAWWWWWW |
题目名称 |
到天宫做客 |
最终得分 |
10 |
用户昵称 |
NickName |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2008-09-08 20:47:44 |
显示代码纯文本
program heaven;
const day:array[0..12] of integer=(0,31,29,31,30,31,30,31,31,30,31,30,31);
var hi,ho:text;
x1,x2:longint;
ls:longint;
jg:real;
n:longint;
temp:longint;
cash:array[1..366,1..2] of integer;
t:longint;
now1,now2:longint;
begin
assign(hi,'heaven.in');
reset(hi);
readln(hi,n);
t:=1;
jg:=0;
for x1:=1 to n do readln(hi,cash[x1,1],cash[x1,2]);
for x1:=1 to n-1 do
for x2:=2 to n do
begin
if cash[x2,1]<cash[x1,1] then
begin
temp:=cash[x2,1];
cash[x2,1]:=cash[x1,1];
cash[x1,1]:=temp;
temp:=cash[x2,2];
cash[x2,2]:=cash[x1,2];
cash[x1,2]:=temp;
end;
if (cash[x2,1]=cash[x1,1]) and (cash[x2,2]<cash[x1,2]) then
begin
temp:=cash[x2,1];
cash[x2,1]:=cash[x1,1];
cash[x1,1]:=temp;
temp:=cash[x2,2];
cash[x2,2]:=cash[x1,2];
cash[x1,2]:=temp;
end;
end;
cash[n+1,1]:=cash[1,1];
cash[n+1,2]:=cash[1,2];
for x1:=1 to n do
begin
ls:=0;
for x2:=cash[x1,1] to cash[x1+1,1]-1 do ls:=ls+day[x2];
ls:=ls-cash[x1,2]+cash[x1+1,2]-1;
if ls>jg then jg:=ls;
end;
jg:=jg*24*3600/366;
close(hi);
assign(ho,'heaven.out');
rewrite(ho);
writeln(ho,round(jg));
close(ho);
end.