327 条题解
-
0zhfqbeyond LV 7 @ 2013-08-27 17:23:31
program tgsdfyw;
var f:array[0..10000]of byte; t,l,m,i,j,a,b:integer;
begin
readln(l,m);
fillchar(f,sizeof(f),1);
for i:=1 to m do
begin
read(a,b);
for j:=a to b do f[j]:=0;
end;
t:=0;
for i:=0 to l do inc(t,f[i]);
writeln(t);
end. -
02013-07-24 16:40:08@
第一次用c++,表示”亚历山大“
-
02013-07-15 17:44:23@
var a,b,c,d:integer;
i,j,k:integer;
m:array[0..1000000]of integer;
begin
read(a,b);
j:=0;
for k:=0 to a do
m[k]:=1;
for i:=1 to b do
begin
read(c,d);
for k:=c to d do
m[k]:=0;
end;
for k:=0 to a do
if m[k]=1 then j:=j+1;
write(j);
end. -
02013-07-10 11:51:15@
var l,m,i,j,a:integer;
x:array[0..100] of integer;
y:array[0..100] of integer;
z:array[0..10000] of integer;
begin
readln(l,m);
a:=0;
for j:=0 to l do
z[j]:=1;
for i:=1 to m do
begin
readln(x[i],y[i]);
for j:=0 to l do
if (x[i]<=j) and (j<=y[i]) or (x[i]>=j) and (j>=y[i])
then z[j]:=z[j]-1;
end;
for j:=0 to l do
if z[j]=1 then a:=a+1;
write(a);
end. -
02013-07-10 10:52:28@
var l,m,tree:longint;
i,h,j:integer;
t:array[1..10000] of integer;
a,b,num:integer;
begin
read(l,m);
for h:=0 to l do t[h]:=1;
for i:=1 to m do
begin
read(a,b);
for j:=a to b do
begin
t[j]:=2;
end;
end;
num:=0;
for i:=0 to l do
begin
if t[i]=1 then num:=num+1;
if l=0 then num:=num-1;
end;
writeln(num);
end.
哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈 -
02013-07-10 10:50:13@
var a,b,c,d:integer;
i,j,k:integer;
m:array[0..1000000]of integer;
begin
read(a,b);
j:=0;
for k:=0 to a do
m[k]:=1;
for i:=1 to b do
begin
read(c,d);
for k:=c to d do
m[k]:=0;
end;
for k:=0 to a do
if m[k]=1 then j:=j+1;
write(j);
end. -
02013-04-17 22:55:14@
var a:array[1..10000]of 0..1;
x,y,i,j,k,m,n:integer;
begin
fillchar(a,sizeof(a),0);
readln(m,n);
for i:=1 to n do
begin
readln(x,y);
for j:=x to y do
a[j]:=1;
end;
for i:=0 to m do
begin
if a[i]=0 then
inc(k);
end;
writeln(k);
readln;
readln
end. -
02012-11-09 11:17:27@
明日决赛,见一水题,刷之以应!
点这里查看程序源码+详细题解
-
02012-10-23 17:47:54@
foo.pas(11,38) Warning: Variable "e" does not seem to be initialized
├ 测试数据 01:答案正确... (0ms, 696KB)
├ 测试数据 02:答案正确... (0ms, 696KB)
├ 测试数据 03:答案正确... (0ms, 696KB)
├ 测试数据 04:答案正确... (0ms, 696KB)
├ 测试数据 05:答案正确... (0ms, 696KB)
├ 测试数据 06:答案正确... (0ms, 696KB)
├ 测试数据 07:答案正确... (0ms, 696KB)
├ 测试数据 08:答案正确... (0ms, 696KB)
├ 测试数据 09:答案正确... (0ms, 696KB)
├ 测试数据 10:答案正确... (0ms, 696KB)---|---|---|---|---|---|---|---|-
Accepted / 100 / 0ms / 696KBview sourceprint?01 program asdflk;
02 var
03 L,M,i,j,e:longint;
04 a,b,c:array[0..10000]of longint;
05 begin
06 read(L,M);
07 for i:=0 to l do a[i]:=1;
08 for i:=1 to m do read(b[i],c[i]);
09 for i:=1 to m do
10 for j:=b[i] to c[i] do a[j]:=0;
11 for i:=0 to l do if a[i]=1 then inc(e);
12 write(e);
13 end.
-
02012-10-16 15:06:41@
区间合并的解法:
首先,将区间按左端点排序,然后用 last 记录当前合并到了哪里,每一次,如果下一个区间的左端点在 last 之前,但是右端点在 last 之后,就加上 右端点到 last 的距离,包含就跳过,完全不交叉就加上这个区间的长度,如果这个区间的右端点 > last 就更新 last。——艾橙 -
02012-08-27 13:26:38@
Water Problem
-
02012-08-07 22:29:39@
-
02012-08-07 09:43:18@
#include
#include
#include
using namespace std;
尼玛被数据范围坑了。。。。
本来只开了101的大小,以为可以。。。
结果尼玛。。。。。
int ans, L, M;
int use[10001][2];
inline bool work(int i);
int main()
{
scanf("%d%d", &L, &M);
for(int i = 1; i -
02012-08-02 14:49:45@
点击查看代码
-
02012-07-27 09:17:42@
好吧 才AC第十道
纪念下吧
var road:array[0..10000] of boolean;
len,i,j,k,l,r,trees:integer;
begin
readln(len,i);
for k:=0 to len do road[k]:=true;
for j:=1 to i do
begin
readln(l,r);
for r:=l to r do road[r]:=false;
end;
for k:=0 to len do if road[k] then inc(trees);
writeln(trees);
end. -
02010-07-17 11:37:48@
a[i]=0表示i这个位置没有树,1表示有。
#include "stdio.h"
int a[10001];
int L,M;
int main()
{
scanf("%d %d",&L,&M);
int i,left,right,sum=0;
for(i=0;i -
02010-04-15 15:31:03@
一次AC,奇迹!
-
02010-04-12 20:35:02@
#include
#includeint l,m,a,b,i,j,s;
int r[10003];
void main()
{
s=0;
scanf("%d %d",&l,&m);
for (i=0;i -
02010-04-11 19:11:53@
too hard
-
02010-03-31 13:12:30@
halt