327 条题解
-
0syr86 LV 5 @ 2010-03-26 21:53:34
var i,j,k,d,l,m,c:integer;
a:array[0..10000]of 0..1;
begin
readln(l,m);
for i:=0 to l do
a[i]:=1;
for i:=1 to m do
begin
readln(k,d);
for j:=k to d do
a[j]:=0;
end;
for i:=0 to l do
if a[i]=1 then c:=c+1;
writeln(c);
end.very easy!
so easy! -
02010-03-18 19:11:52@
var r : array[0..10010] of boolean;
l, m, a, b, x,j,s,k : integer;
begin
read(l,m);
for x:=1 to m do begin
readln(a,b);
for j:=a to b do r[j]:=True;
end;
s:=0;
for k:=0 to l do begin
if r[k]=false then s:=s+1;
end;
writeln(s);
end. -
02010-03-16 19:19:47@
。。。好难
-
02010-03-11 20:06:54@
var
d:array[1..1000] of integer;
a,b,i,l:integer;
s:integer;
begin
read(l,m);
for i:=1 to l do d[i]:=1;
for i:=1 to m do
begin
readln(a,b);
for i:=a to b do d[i]:=0;
end;
s:=0;
for i:=1 to l do s:=s+d[i];
end. -
02009-11-11 20:17:16@
so easy
-
02009-11-11 20:12:33@
var
s:array[0..10000] of 0..1; a,b,l,m,k,i,j:longint;
begin
readln(l,m); k:=0;
for i:=1 to m do
begin
readln(a,b);
for j:=a to b do
s[j]:=1;
end;
for i:=0 to l do
if s[i]=0 then inc(k);
writeln(k);
readln;
end. -
02009-11-08 09:30:37@
var a:array[1..10000] of longint;
b:array[1..10000] of boolean;
cd,g,s,i,j:longint;
begin
read(cd,g);
for i:=0 to cd do
b[i]:=true;
for i:=1 to 2*g do
begin
read(a[i]);
if i mod 2=0 then
begin
for j:=a to a[i] do
b[j]:=false;
end;
end;
for i:=0 to cd do
if b[i]=true then s:=s+1;
writeln(s);
end. -
02009-11-02 17:38:35@
#include
using namespace std;
int main()
{ int l,m,sum=0;
cin>>l>>m;
int cont[l+1];for(int i=0;iaa>>bb;
for(int j=aa;j -
02009-11-02 15:17:41@
汗,我还用的快排+线段合并
刚做完火烧赤壁那道题,想多了..。 -
02009-10-31 23:20:49@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms -
02009-10-27 16:39:29@
program xmwds;
var
ar:array[0..10000]of boolean;
l,m,i,j,a,b:integer;
begin
readln(l,m);
fillchar(ar,sizeof(ar),true);
for i:=1 to m do
begin
readln(a,b);
for j:=a to b do ar[j]:=false;
end;
m:=0;
for i:=0 to l do
if ar[i] then inc(m);
writeln(m);
end. -
02009-10-28 20:11:15@
`
\
-
02009-10-23 16:22:55@
program lx1;
var l,m,i,j,x,y,sum:longint;
a:array[0..10000] of boolean;
begin
readln(l,m);
for i:=0 to l do a[i]:=true;
for i:=1 to m do begin
readln(x,y);
for j:=x to y do a[j]:=false;
end;
for i:=0 to l do if a[i]=true then inc(sum);
writeln(sum);
end. -
02009-10-21 21:35:30@
program lx1;
var l,m,i,j,x,y,sum:longint;
a:array[0..10000] of boolean;
begin
readln(l,m);
for i:=0 to l do a[i]:=true;
for i:=1 to m do begin
readln(x,y);
for j:=x to y do a[j]:=false;
end;
for i:=0 to l do if a[i]=true then inc(sum);
writeln(sum);
end. -
02009-10-19 17:21:25@
var
n,m:longint;
a:array[0..10000] of boolean;
i,j,k,t,ans:longint;
begin
readln(n,m);
fillchar(a,sizeof(a),false);
ans:=n+1;
for k:=1 to m do
begin
readln(i,j);
for t:=i to j do
if a[t]=false then begin dec(ans);a[t]:=true; end;
end;
writeln(ans);
end. -
02009-10-14 22:54:21@
没事刷水题,注意0开始
var
n,m:longint;
a:array[0..10000] of boolean;
i,j,k,t,ans:longint;
begin
readln(n,m);
fillchar(a,sizeof(a),false);
ans:=n+1;
for k:=1 to m do
begin
readln(i,j);
for t:=i to j do
if a[t]=false then begin dec(ans);a[t]:=true; end;
end;
writeln(ans);
end. -
02009-10-13 17:11:09@
program xiaomenwaideshu;
var a:array[0..1000]of boolean;
i,j,l,m,b,e,s:integer;
begin
fillchar(a,sizeof(a),false);
readln(l,m);
for i:=1 to m do
begin
readln(b,e);
for j=b to e do a[j]:=true;
end;
s:=0;
for i:=0 to l do
if not a[i] then inc(s);
writeln(s);
end. -
02009-10-08 10:45:56@
不好意思
-
02009-10-07 22:01:28@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
哈哈 第一次写线段树就把校门外的树1A了~~ -
02009-10-03 09:23:05@
#include
using namespace std;
int main()
{
int i,j,k[10001],a,b,c,d;
cin>>i>>j;
for(a=0;ab>>c;
for(d=b;d