- 分享
- 2009-11-11 22:39:11 @
program joseph;
var
n,i,ans:longint;
pc:array [1..100] of boolean;
procedure test(x:longint);
var
i,jl,js:longint;
pd:boolean;
begin
fillchar(pc,sizeof(pc),true);
jl:=0;
pd:=true;
for i:=1 to n do begin
js:=0;
repeat
inc(jl);
if jl>2*n then jl:=jl mod(2*n);
if jl=0 then jl:=2*n;
if pc[jl]=true then inc(js);
until js=x;
pc[jl]:=false;
if jlmaxlongint;
end.
Program heaven;
const
day:array[1..12]of shortint=(31,29,31,30,31,30,31,31,30,31,30,31);
var
n,i,j,x,max,t:longint;
m,d:array[1..1000]of integer;
begin
readln(n);
for i:=1 to n do
readln(m[i],d[i]);
for i:=1 to n-1 do
for j:=i+1 to n do
if (m[i]>m[j])or(m[i]=m[j])and(d[i]>d[j]) then begin
t:=m[i];
m[i]:=m[j];
m[j]:=t;
t:=d[i];
d[i]:=d[j];
d[j]:=t;
end;
j:=1;
max:=0;
x:=0;
for i:=1 to 12 do
if im[j] then x:=x+day[i]
else begin
repeat
x:=x+d[j]-1;
if x>max then max:=x;
inc(j);;
x:=0;
until im[j];
x:=x+31-d[j-1];
end;
writeln(max/366*24*60*60:0:0);
close(input);
close(output);
end.