记录编号 |
4884 |
评测结果 |
AAAAAAAAAA |
题目名称 |
到天宫做客 |
最终得分 |
100 |
用户昵称 |
EnAsn |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.014 s |
提交时间 |
2008-10-22 22:20:18 |
内存使用 |
0.12 MiB |
显示代码纯文本
program ex;
const
a:array[0..12]of integer=
(0,31,60,91,121,152,182,213,244,274,305,335,366);
type
ss=array[0..367]of longint;
sz=array[1..366,1..2]of integer;
var
f:ss;
b:sz;
f1,f2:text;
n:integer;
procedure init;
var
i,t,j,m,d,x,y,t1,t2:integer;
begin
assign(f1,'heaven.in');
assign(f2,'heaven.out');
reset(f1);
rewrite(f2);
readln(f1,n);
for i:=1 to n do
readln(f1,b[i,1],b[i,2]);
for i:=1 to n-1 do
for j:=i+1 to n do
if (b[i,1]>b[j,1])
or(b[i,1]=b[j,1])and(b[i,2]>b[j,2])
then begin
x:=b[i,1]; y:=b[i,2];
b[i,1]:=b[j,1]; b[i,2]:=b[j,2];
b[j,1]:=x; b[j,2]:=y;
end;
t:=0;
for i:=1 to n do
begin
t1:=a[b[i,1]-1];
t2:=b[i,2];
f[i]:=t1+t2-1-t;
t:=a[b[i,1]-1]+b[i,2];
end;
f[n+1]:=a[12]-t;
close(f1);
end;
procedure main;
var
i,j,temp:integer;
ans:real;
begin
ans:=0;
for i:=1 to n do
for j:=i+1 to n+1 do
if f[i]<f[j] then
begin
temp:=f[i];
f[i]:=f[j];
f[j]:=temp;
end;
ans:=(f[1]/366)*24*3600;
writeln(f2,ans:0:0);
end;
begin
init;
main;
close(f2);
end.