题解

249 条题解

  • 0
    @ 2009-08-17 15:45:30

    #include

    main()

    {

    freopen ("test.in","r",stdin);

    freopen ("test.out","w",stdout);

    int i,n,m,count,j;

    int app[3000],tao[3000],jl[2];

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

    count=m;

    for (i=1;i

  • 0
    @ 2009-08-16 19:02:55

    一次性AC

    注意负数

    水题

  • 0
    @ 2009-08-11 09:04:37

    草,还有负的

  • 0
    @ 2009-08-08 22:19:34

    只需改一个字母...就过啦

    所谓一字千金啊!!

  • 0
    @ 2009-08-08 09:09:21

    var

    i,j,n,m:longint;

    apple,tt:array[-1..3000] of longint;

    a:array[-1..3000] of boolean;

    procedure swap(var a,b:longint);

    var c:longint;

    begin

    c:=a;a:=b;b:=c;

    end;

    begin

    readln(n,m);

    for i:=1 to n do readln(apple[i]);

    for i:=1 to m do readln(tt[i]);

    for i:=1 to n-1 do

    for j:=i+1 to n do

    if apple[i]>=apple[j] then swap(apple[i],apple[j]);

    for i:=1 to m-1 do

    for j:=i+1 to m do

    if tt[i]>=tt[j] then swap(tt[i],tt[j]);

    fillchar(a,sizeof(a),true);

    i:=n;j:=m;

    repeat

    while (j>0) and (tt[j]>0) and (apple[i]

  • 0
    @ 2009-09-02 20:23:53

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    program ex;

    var i,j,z,n,m,t,k:longint;

    a,b:array[1..2000] of longint;

    procedure try;

    begin

    for j:=1 to m do

    begin

    if (a[i]>b[j])and(b[j]>0) then begin

    z:=z+1;b[j]:=maxint;exit;end;

    end;

    end;

    begin

    readln(n,m);k:=1;

    for i:=1 to n do readln(a[i]);

    for i:=1 to m do readln(b[i]);

    for i:=1 to n-1 do

    for j:=i+1 to n do

    begin

    if a[i]

  • 0
    @ 2009-08-05 19:28:37

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    囧...粗心害死人啊...

    顺便庆祝下...俺小菜半星了...

    第9个AC...

  • 0
    @ 2009-08-05 10:50:17

    快排+看请题目=AC

  • 0
    @ 2009-08-04 20:56:15

    帮忙以下,那里错了

    program ex9;

    var m,n,i,j,mi:integer;

    a,b:array[1..2000]of integer;

    pd:array[1..2000]of boolean;

    procedure kp(l,r:integer);

    var i,j,mid,mp:integer;

    begin

    i:=l; j:=r; mid:=b[(r-l) div 2];

    repeat

    while b[i]mid do dec(j);

    if ij;

    if j>1 then kp(1,j);

    if ib[j]) and (pd[j]=true) or (j=0);

    if j>=1 then pd[j]:=false;

    end;

    for i:=1 to m do

    if pd[i]=true then inc(mi);

    write(mi);

    readln;

    end.

  • 0
    @ 2009-07-31 15:32:25

    var

    a,b:array[1..300] of integer;

    n,m,i,j,nn:integer;

    begin

    read(n,m);

    nn:=m

    for i:=1 to n do

    read(a[i]);

    for j:=1 to m do

    read(b[j]);

    for i:=1 to n do

    for j:=1 to m do

    if a[i]

  • 0
    @ 2009-07-29 10:55:18

    Help!!!!!!!!!!!!!!!!!!

    编译通过...

    ├ 测试数据 01:答案错误...

     ├ Hint: 本Config.in为VijosConfig.ini制作工具生成,Copyright by CoVH Team ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 02:答案错误...程序输出比正确答案长

    ├ 测试数据 03:答案错误...程序输出比正确答案长

    ├ 测试数据 04:答案错误...

     ├ Hint: 本Config.in为VijosConfig.ini制作工具生成,Copyright by CoVH Team ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 05:答案错误...程序输出比正确答案长

    ├ 测试数据 06:答案错误...程序输出比正确答案长

    ├ 测试数据 07:答案错误...程序输出比正确答案长

    ├ 测试数据 08:答案错误...程序输出比正确答案长

    ├ 测试数据 09:答案错误...程序输出比正确答案长

    ├ 测试数据 10:答案错误...

     ├ Hint: 本Config.in为VijosConfig.ini制作工具生成,Copyright by CoVH Team ├ 标准行输出

     ├ 错误行输出

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

    Unaccepted 有效得分:0 有效耗时:0ms

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

    tt:array[1..300] of integer;

    t,n,m,i:integer;

    begin

    readln(n,m);

    fillchar(tt,sizeof(tt),0);

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

    for i:=1 to m do

    begin

    read(t);

    if t>0 then inc(tt[t]);

    end;

    for i:=1 to n do

    begin

    t:=a[i];

    while (tt[t]0) do

    dec(t);

    if t0 then dec(tt[t]);

    end;

    t:=0;

    for i:=1 to m do

    if tt[i]0 then t:=t+tt[i];

    write(m-t);

    end.

  • 0
    @ 2009-07-28 18:07:27

    太水了,出题人只说小于0时的情况,等于0也要考虑....

  • 0
    @ 2009-07-27 16:12:16

    read反了,WA了N次才发现....

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    type ttt=array[1..2000,1..2] of integer;

    apt=array[1..2000] of integer;

    var tt:ttt;

    ap:apt;

    a,b,maxtt,maxap:integer;

    procedure huan(var a,b:integer);

    var c:integer;

    begin

    c:=a;

    a:=b;

    b:=c;

    end;

    procedure qsort(var a:ttt;l,r:integer);

    var il,ir,m,tmp:integer;

    begin

    il:=l;

    ir:=r;

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

    while ilm do inc(il);

    while a[ir,1]0) then

    begin

    tt:=1;

    break;

    end;

    b:=0;

    for a:=1 to maxtt do

    if tt[a,2]=0 then b:=b+1;

    write(b);

    end.

  • 0
    @ 2009-07-26 14:22:15

    为什么

  • 0
    @ 2009-07-24 09:36:53

    program cc(input,output);

    var

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

    a,b:array[1..2000] of integer;

    begin

    readln(n,m);

    for i:=1 to n do

    readln(a[i]);

    for i:=1 to m do

    readln(b[i]);

    for i:=1 to m-1 do

    for j:=i+1 to m do

    if a[i]=b[i] then

    m:=m-1;

    if b[i]

  • 0
    @ 2009-07-24 09:32:50

    var n,m,min,j,e,i,t,k:longint; a,b:array[0..10000]of integer;

    begin

    readln(n,m);

    for i:=1 to n do readln(a[i]);

    for i:=1 to m do readln(b[i]);

    for i:=1 to m-1 do

      for j:=i+1 to m do if b[i]0 do inc(k);

    for i:=1 to n do

    begin

      for j:=1 to k do if a[i]>b[j] then

      begin

       inc(e);

       b[j]:=maxint;

       break;

      end;

    end;

    write(m-e);

    end.

  • 0
    @ 2009-07-24 09:04:06

    program zhjh;

    var i,j,k,m,n,o,p:integer;

    a,b:array[1..2000] of integer;

    begin

    readln(n,m);

    p:=m;

    for i:=1 to n do

    readln(a[i]);

    for i:=1 to m do

    readln(b[i]);

    for i:=1 to n-1 do

    for j:=i+1 to n do

    if a[i]

  • 0
    @ 2009-07-23 13:01:09

    各位.小心烂陶陶....

    这个题就是用来降低大家通过率的...我WA了N次后,我发现烂TT这个问题....

  • 0
    @ 2009-07-20 16:12:25

    program zhjh;

    var i,j,k,m,n,o,p:integer;

    a,b:array[1..2000] of integer;

    begin

    readln(n,m);

    p:=m;

    for i:=1 to n do

    readln(a[i]);

    for i:=1 to m do

    readln(b[i]);

    for i:=1 to n-1 do

    for j:=i+1 to n do

    if a[i]

  • 0
    @ 2009-07-17 20:01:26

    var

    a :array[0..2000]of longint;

    t :array[-9999999..300]of longint;

    i,j,n,m,b :longint;

    begin

    readln(n,m);

    fillchar(t,sizeof(t),0);

    for i:=1 to n do

    readln(a[i]);

    for j:=1 to m do begin

    readln(b);

    inc(t);

    end;

    for i:=1 to n do

    for j:=a[i]-1 downto 1 do

    if t[j]>0 then begin

    dec(t[j]);

    break;

    end;

    m:=0;

    for i:=-9999999 to 300 do

    m:=m+t[i];

    writeln(m);

    end.

    计数排序+高度大于0=AC

信息

ID
1291
难度
6
分类
贪心 点击显示
标签
(无)
递交数
9761
已通过
2342
通过率
24%
被复制
16
上传者