题解

327 条题解

  • 0
    @ 2009-09-25 17:50:13

    program test;

    var

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

    l,m,i,j,s,e,ans:integer;

    begin

    readln(l,m);

    fillchar(a,sizeof(a),0);

    for i:= 1 to m do

    begin

    readln(s,e);

    for j:= s to e do

    a[j]:=1;

    end;

    ans:=0;

    for i:= 0 to l do

    if a[i]=0 then inc(ans);

    writeln(ans);

    end.

  • 0
    @ 2009-09-25 13:25:26

    貌似用C的很少。。

    #include

    main()

    {

    int l,m,i,a,b,j,s,t[10001];

    scanf("%d%d",&l,&m);

    s=0;

    for(i=0;i

  • 0
    @ 2009-09-16 20:59:24

    #include

    using namespace std;

    main()

    {

    int l,m;

    int i,a,b,j;

    int tree[10001]={0};

    cin>>l>>m;

    for(i=1;i>a>>b;

    for(j=a;j

  • 0
    @ 2009-09-15 16:48:25

    program vijos_p1103;

    var a:array[0.10000]:bloolean;

    i,j,l,m:integer;

    begin

    fillchar(a,sizeof(a),ture);

    readln(l,m);

    for i:=1 to m do

    begin

    readln(a,b);

    for j:=a to b do a[j]:=false;

    end;

    for i:=0 to l do

    if a[i]=ture then m:=m+1;

    writeln(m);

    end.

  • 0
    @ 2009-09-14 22:04:13

    【a,a】叶结点

    program exe01(input,output);

    var a:array[1..50000,1..2] of longint;

    tree:array[1..50000] of longint;

    t,sum,i,j,n,m,x,y,l,p,q:longint;

    procedure create(i,l,r:longint);

    var p,q,m:longint;

    begin

    m:=(l+r) div 2;

    a:=l;

    a:=r;

    if l>=r then exit;

    create(i*2,l,m);

    create(i*2+1,m+1,r);

    end;

    procedure make({x,y,}t:longint);

    var i,j,m,p,q:longint;

    begin

    if tree[t]=1 then

    sum:=sum-(a[t,2]-a[t,1]+1);

    if tree[t]=-1 then

    begin

    make(2*t);

    make(2*t+1);

    end;

    end;

    procedure insert(x,y,t:longint);

    var i,j,p,q,l,s,m,w:longint;

    begin

    if x>y then exit;

    if (x=a[t,1]) and (y=a[t,2]) then

    begin

    tree[t]:=1;

    end

    else

    if tree[t]1 then

    begin

    m:=(a[t,1]+a[t,2]) div 2+1;

    tree[t]:=-1;

    if y=m then

    insert(x,y,t*2+1)

    else

    begin

    insert(x,m-1,t*2);

    insert(m,y,t*2+1);

    end;

    end;

    end;

    begin

    fillchar(a,sizeof(a),0);

    readln(l,n);

    sum:=l+1;

    create(1,0,l);

    for i:=1 to n do

    begin

    readln(x,y);

    insert(x,y,1);

    end;

    make(1);

    writeln(sum);

    end.

  • 0
    @ 2009-09-09 20:53:48

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

    楼上的说得太对了,一定要注意是从0开始的……因为这个得了3回10分……

  • 0
    @ 2009-09-07 21:16:35

    I like playing water games!

  • 0
    @ 2009-09-07 13:09:51

    虽然现在过了 可是为什么这个过不了??

    program p1103;

    var l,j,m,i,sum,o,p:integer;

    c:array[1..10000] of integer;

    begin

    sum:=1;

    readln(l,m);

    fillchar(c,sizeof(c),0);

    for i:=1 to m do

    begin

    readln(o,p);

    for j:=o to p do

    c[j]:=1;

    end;

    for i:=1 to l do

    if c[i]=0

    then inc(sum);

    write(sum);

    end.

    只有90??

  • 0
    @ 2009-09-06 20:56:48

    var

    i,l,m,b,e,ans,j:integer;

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

    begin

    readln(l,m);

    fillchar(x,sizeof(x),true);

    for i:=1 to m do

    begin

    readln(b,e);

    for j:=b to e do

    x[j]:=false;

    end;

    ans:=0;

    for i:=0 to l do

    if x[i] then inc(ans);

    writeln(ans);

    readln;

    readln;

    end.

  • 0
    @ 2009-09-06 09:04:51

    var a:array[0..10000]of 0..1;

    i,j,t,b,n,v,o,l,m:integer;

    begin

    t:=0;

    read(l,m);

    for i:=0 to l do

    a[i]:=0;

    for i:=1 to m do

    begin

    readln(o,v);

    for j:=o to v do

    a[j]:=1;

    end;

    for i:=0 to l do

    if a[i]=0 then t:=t+1;

    write(t);

    end.

    一次过,水题啊

  • 0
    @ 2009-08-28 09:20:39

    var

    a:array[1..10001]of integer;

    i,l,m,s,n,d,j:integer;

    begin

    read(l);

    read(m);

    for i:=1 to m do

    begin

    read(s,n);

    for j:=s to n do

    a[j]:=1;

    end;

    for i:=1 to l+1 do

    if a[i]=0 then

    d:=d+1;

    if d=7 then d:=d-1;

    write(d);

    end.

    无语,评测机太猥琐

  • 0
    @ 2009-08-26 10:46:46

    注意是从0开始。。。。

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

    program p1103;

    var l,m,i,a,b,j,s:integer;

    t:array[1..10000] of integer;

    begin

    readln(l,m);

    s:=0;

    for i:=0 to l do t[i]:=1;

    for i:=1 to m do begin

    readln(a,b);

    for j:=a to b do t[j]:=0;

    end;

    for i:=0 to l do if t[i]=1 then inc(s);

    writeln(s);

    end.

  • 0
    @ 2009-08-25 15:17:11

    var

    h,t,i,ans,m,l:longint;

    a:array[1..100,1..2] of longint;

    x,y:array[1..2] of longint;

    procedure qs(l,r:longint);

    var

    i,j:longint;

    begin

    i:=l;

    j:=r;

    x:=a[random(r-l)+l];

    repeat

    while ax[1] do dec(j);

    if ij;

    if l

  • 0
    @ 2009-08-22 19:52:36

    program p1103(input,output);

    var

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

    l,m,i,j,x,y,ans:integer;

    begin

    fillchar(a,sizeof(a),0);

    readln(l,m);

    ans:=0;

    for i:=1 to m do

    begin

    readln(x,y);

    for j:=x to y do

    a[j]:=1;

    end;

    for i:=0 to l do

    if a[i]=0

    then inc(ans);

    writeln(ans);

    end.

  • 0
    @ 2009-08-20 11:24:56

    我竟然用快排交了两遍!

    没想到啊!

    别想太复杂了,基本算法就能过!

  • 0
    @ 2009-08-17 20:58:38

    program p_1;

    var

    a:array[1..100,1..2] of integer;

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

    i,j,k,l,n:integer;

    begin

    read(l,n);

    for i:=0 to 10000 do b[i]:=false;

    for i:=1 to n do read(a,a);

    for i:=0 to l do b[i]:=true;

    for i:=1 to n do

    for j:=a to a do

    b[j]:=false;

    for i:=0 to l do

    if b[i] then k:=k+1;

    write(k);

    end.

  • 0
    @ 2009-08-17 06:44:48

    线段树。。。话说我真是无聊啊。。。

    #include

    #include

    using namespace std;

    const int maxn=40000,none=-2;

    struct TreeNode

    {

    int a,b,left,right,cover;

    };

    struct Tree

    {

    TreeNode Tree[maxn];

    int tot,c,d,number;

    void BuildTree(int s,int t)

    {

    tot++;

    TreeNode& Now=Tree[tot];

    Now.a=s;Now.b=t;Now.cover=0;

    if(s+1>N>>M;

    T.init();

    T.BuildTree(0,N);

    int a,b;

    for(int i=0;i>T.c>>T.d;

    T.Insert(1);

    }

    T.Count(1);

    cout

  • 0
    @ 2009-08-16 20:13:06

    var i,j,s,l,m:integer;

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

    b,c:array[0..100] of integer;

    begin

    readln(l,m);

    for i:=0 to l do

    a[i]:=1;

    for i:=1 to m do

    readln(b[i],c[i]);

    for i:=1 to m do

    for j:=b[i] to c[i] do

    a[j]:=0;

    for i:=0 to l do

    s:=s+a[i];

    writeln(s);

    end.

  • 0
    @ 2009-08-14 18:34:30

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

    送分

  • 0
    @ 2009-08-12 21:23:32

    #include

    using namespace std;

    int main()

    {

    int l,m,a[101],b[101],sum=0;

    bool s[10001];

    cin>>l>>m;

    for(int i=0;ia[i]>>b[i];

    for(int i=1;i

信息

ID
1103
难度
4
分类
模拟 点击显示
标签
递交数
14316
已通过
6534
通过率
46%
被复制
54
上传者