比赛 2008haoi模拟训练3 评测结果 AWWWWWWWTW
题目名称 阶梯教室设备利用 最终得分 10
用户昵称 NickName 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-04-24 11:32:15
显示代码纯文本
program rezz;
var n:integer;
rez:array[1..10000,1..2] of integer;
ri,ro:text;
x1,x2:integer;
time:longint;
now:integer;
long:longint;
procedure go;
var x:integer;
begin
for x:=1 to n do
begin
if rez[x,1]>=now then
begin
now:=rez[x,2];
time:=time+(rez[x,2]-rez[x,1]);
if long<time then long:=time;
go;
now:=rez[x,1];
time:=time-(rez[x,2]+rez[x,1]);
end;

end;
end;
begin
assign(ri,'rez.in');
assign(ro,'rez.out');
reset(ri);
rewrite(ro);
readln(ri,n);
for x1:=1 to n do
begin
read(ri,rez[x1,1]);
read(ri,rez[x1,2]);
readln(ri);
end;
time:=0;
long:=0;
now:=0;
go;
writeln(ro,long);
close(ri);
close(ro);
end.