- 校门外的树
- 2009-07-25 22:39:06 @
var judge:array[-1..10000] of boolean;
a,b,m,n,i,j,total:integer;
begin
readln(m,n);
fillchar(judge,sizeof(judge),true);
for i:=1 to n do
begin
read(a,b);
for j:=a to b do
judge[j]:=false;
end;
total:=0;
for i:=1 to m do
if judge[i] then total:=total+1;
write(total+1);
end.
5 条评论
-
duchuan LV 8 @ 2015-02-10 11:22:57
var l,m,i,j,num:longint;
a:array[1..10000,1..2]of longint;
b:array[1..10000]of boolean;
procedure init;
begin
read(l,m);
for i:=1 to m do readln(a[i,1],a[i,2]);
for i:=0 to l do b[i]:=true;
end;
procedure deal;
begin
for i:=0 to m do
for j:=a[i,1] to a[i,2] do
b[j]:=false;
end;
procedure addprint;
begin
for i:=1 to l do if b[i] then inc(num);
write(num+1);
end;
begin
init;
deal;
addprint;
end. -
2014-11-02 08:49:11@
我也90,谁能帮我看看,感激不尽。
program aa;
var a:array[0..10000]of integer;
l,i,j,m,x,y,ans:integer;
begin
readln(l,m);
ans:=0;
for i:=1 to l do a[i]:=1;
for i:=1 to m do
begin
readln(x,y);
for j:=x to y do
a[j]:=0;
end;
for i:=0 to l do
if a[i]=1 then inc(ans);
writeln(ans+1);
end. -
2013-08-19 16:06:37@
我一开始也是90,和你一样,后来过了
for i:=1 to m do,你得从0开始搜 -
2013-04-13 18:02:07@
for i:=0 to m do
if judge[i] then total:=total+1;
应该是这样,再试试 -
2009-08-04 16:46:40@
type
re=record
date:integer;
date2:integer;
end;
var
a:array[1..100] of re;
b:array[1..10000] of boolean;
l,i,j,k,temp,max:integer;
begin
readln(l,k);
fillchar(b,sizeof(b),true);
for i:=1 to k do readln(a[i].date,a[i].date2);
for i:=1 to k do for j:=a[i].date to a[i].date2 do b[j]:=false;
for i:=0 to l do if b[i] then inc(max);
writeln(max);
end.兄弟..我的也是啊
第一个数据没过,多了一..
可能少看了一个细节吧..望知情的大牛出声纠正.哈
- 1