- 火烧赤壁
- 2018-07-27 22:06:44 @
var
i,n,a,b,j,d,e,q,m:integer;
c:array[-100000..100000] of integer;
begin
read(n);
for i:=1 to n do
begin
readln(a,b);
for j:=a to b do c[j]:=1;
if a<d then d:=a;
if b>e then e:=b;
end;
for i:=d to e do
if c[i]=1 then
begin
a:=i;
q:=1;
end
else if q=1 then
begin
m:=m+i-1-a;
q:=0;
end;
writeln(m);
end.
0 条评论
目前还没有评论...