讨论 / AC代码
wangtao37 2019-07-22 17:51:42
点我顶贴 收藏 删除
var

n,q,i,j,x,y,s:longint;

a:array[0..10000] of boolean;

begin

readln(n,q);

for i:=1 to q do

begin

readln(x,y);

for j:=x to y do a[j]:=true;

end;

for i:=0 to n do if a[i] then inc(s);

writeln(n-s+1);

end.

查看更多回复
提交回复