Ray 2012-08-25 02:57:00
点我顶贴
收藏
删除
program ljlf;
var
a:array [1..10000]of integer;
l,m,i,j,b,c:integer;
begin
readln(l,m);
l:=l+1;
for i:=1 to l do
a[i]:=1;
for i:=1 to m do
begin
readln(b,c);
for j:=b to c do
a[j]:=0;
end;
j:=0;
for i:=1 to l do
if a[i]=1 then inc(j);
write(j);
end.
#2 lqy1997918@2012-08-07 19:50:00
26836
回复
删除
哪错了
var
l,n,i,j,k,total,c,b:longint;
a:array[0..1001] of boolean;
begin
read(l,n);
for i:=0 to l do a[i]:=true;
for j:=1 to n do
begin
readln(c,b);
for k:=c to b do a[k]:=false;
c:=0; b:=0;
end;
total:=0;
for i:=0 to l do
if a[i] then total:=total+1;
write(total);
end.