- 校门外的树
- @ 2016-08-15 14:26:20
var i,j,l,m,x,y,t:longint;
a:array[0..10001]of longint;
begin
readln(l,m);
for i:=1 to m do begin
readln(x,y);
for j:=x to y do a[j]:=1;
end;
for i:=1 to l do if a[i]=0 then t:=t+1;
writeln(t);
end.
3 条评论
-
ljt12138 LV 10 @ 2016-08-21 15:35:38
为什么不用差分呢代码更短233
-
@ 2016-08-16 12:44:13
大神对待水题的方法
-
@ 2016-08-15 17:50:07
经测试线段树比这方法快一点点,是不是很无聊。。
- 1