170 条题解

  • 0
    @ 2009-08-13 21:17:20

    从左边开始,对每个女生在她左边离她最近的未标号那个男生,就是她的舞伴。

  • 0
    @ 2009-08-13 18:05:25

    var

    i,n,x1,x2,h,j,k:longint;

    a,b:array[0..1500] of longint;

    begin

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

    readln(n);h:=0;

    for i:=1 to n do

    begin

    read(x1);

    a[i]:=x1-x2;x2:=x1;

    end;

    for i:=1 to n do

    for j:=i downto 1 do

    begin

    inc(k,b[j]);

    if a[j]0 then

    begin

    dec(a[j]);inc(b[j]);write(k+1,' ');k:=0;break;

    end;

    end;

    end.

  • 0
    @ 2009-08-11 18:33:58

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    非常简单,开两个数组,分别记录这个女孩子到她左边那个女孩中间有几个男孩,和,其中这几个男孩有几个被配对过.

    KEY : 必然有一个女孩所配对的男孩是她左边最近的一个男孩.

  • 0
    @ 2009-08-10 16:00:59

    结果小于2^31-1

    一直纠结于这句话……

    结果提交后发现,数组开20000可过,说明最大的距离小于10000……太纠结了。

  • 0
    @ 2009-08-10 11:28:50

    编译通过...

    ├ 测试数据 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-07 17:03:56

    长信心……

  • 0
    @ 2009-08-04 17:45:52

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    数组要开大点。。。我开了30000

    很水。。。

  • 0
    @ 2009-08-03 08:14:36

    ...汗..wa了5次才a..

  • 0
    @ 2009-07-30 16:38:36

    评测机有问题,第一次提交,一直running,结果上面的人都AC了,我还在running。

    重新提交一次,AC了,可原来那个记录还在running

  • 0
    @ 2009-07-27 13:53:55

    水题....

    180纪念...

  • 0
    @ 2009-07-27 13:32:00

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

    模拟,秒杀。

  • 0
    @ 2009-07-24 07:23:38

    水题破70,特此纪念

  • 0
    @ 2009-07-20 21:06:11

    var

    a,c :array[0..100000]of longint;

    b :array[0..100000]of longint;

    s :array[0..100000]of longint;

    boy :longint;

    top :longint;

    n :longint;

    i,j :longint;

    k,m :longint;

    z :longint;

    procedure push(x:longint);

    begin

    inc(top);

    s[top]:=x;

    end;

    function check(y:longint):boolean;

    begin

    if top>=2 then begin

    check:=false;

    for k:=top-1 downto 1 do begin

    if s[k]3 then begin m:=k;break; end;

    end;

    if (s[top]=1) and (s[m]=2) then check:=true;

    end

    else

    check:=false;

    end;

    procedure popdo;

    begin

    s[top]:=3;

    s[m]:=3;

    boy:=0;

    if top=m+1 then begin c[m]:=1;exit; end;

    for i:=m to top do

    if s[i]=3 then boy:=boy+1;

    boy:=boy div 2;

    c[m]:=boy;

    boy:=0;

    end;

    begin

    readln(n);

    for i:=1 to n do

    read(a[i]);

    for i:=1 to a[n]+n do b[i]:=1;

    fillchar(s,sizeof(s),0);

    for i:=1 to n do

    b[a[i]+i]:=2;

    top:=0;

    boy:=0;

    for i:=1 to a[n]+n do begin

    push(b[a[n]+n-i+1]);

    if (top>=2) and check(top) then begin popdo; end;

    end;

    for i:=n+a[n] downto 1 do

    if c[i]0 then write(c[i],' ');

    end.

  • 0
    @ 2009-07-12 17:39:51

    为什么我只得了10分?为什么男女生组数可能大于n?为什么我改到两W后仍只有10分?哪位高手帮帮我?

  • 0
    @ 2009-07-12 10:08:30

    注意最下面的那个话,害死我了

  • 0
    @ 2009-07-11 17:57:41

    友情提示:给出的是前N个女生的信息,也就是说最后一个女生的左边可能有超过N个男生。

    呵呵呵,不管潜规则,按此句理解的话,n虽然只有1500,但是男女生数组可能远大于1500。楼下没开够数组的……

  • 0
    @ 2009-07-03 15:59:03

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    program p1062;

    var a:array[1..30000] of integer;

    n,i,boy,j,k,m:integer;

    begin

    readln(n);

    for i:=1 to n do

    begin

    read(boy);

    for j:=1 to k+boy-m do inc(a[j]);

    write(a[j],' ');

    k:=j-1; a[j]:=0;

    m:=boy;

    end;

    end.

  • 0
    @ 2009-06-30 23:01:06

    var

    i,n,x1,x2,h,j,k:longint;

    a,b:array[0..1500] of longint;

    begin

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

    readln(n);h:=0;

    for i:=1 to n do

    begin

    read(x1);

    a[i]:=x1-x2;x2:=x1;

    end;

    for i:=1 to n do

    for j:=i downto 1 do

    begin

    inc(k,b[j]);

    if a[j]0 then

    begin

    dec(a[j]);inc(b[j]);write(k+1,' ');k:=0;break;

    end;

    end;

    end.

    哈哈

  • 0
    @ 2009-06-05 17:03:03

    模拟.

    var a,b:array[0..100000] of longint;

    v:array[0..3000] of longint;

    i,j,n,p,k,t,x:longint;

    begin

    readln(n);

    v[0]:=0;

    for i:=1 to n do read(v[i]);

    p:=1;

    for i:=1 to n do

    begin

    for j:=1 to v[i]-v do begin a[p]:=0; inc(p); end;

    a[p]:=-1; inc(p);

    end;

    dec(p);

    t:=1;

    for i:=1 to p do

    begin

    if a[i]=0 then begin a[i]:=t; inc(t); end;

    if a[i]=-1 then if a>0 then a[i]:=-a

    else a[i]:=a;

    end;

    k:=1; t:=0;

    b[0]:=0;

    b[1]:=1;

    while b[k]>0 do

    begin

    for i:=k+2*t to p do

    begin

    b:=a[i];

    if b0 then

    begin

    write(x);

    if t

  • 0
    @ 2009-05-21 22:26:19

    注释的n

信息

ID
1062
难度
4
分类
数据结构 | 点击显示
标签
递交数
3510
已通过
1400
通过率
40%
被复制
11
上传者