求助 苹果摘陶陶 全错

var

q,w,p,o,z,x:integer;

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

begin

readln(z,x);

for q:=1 to z do read(a[q]);

for q:=1 to x do read(s[q]);

for q:=1 to z do begin

for w:=1 to x do

if (a[q]>s[w])then begin

o:=s[w];

p:=w;

break;

end;

for w:=p+1 to x do

if (o>s[w])and(a[q]>s[w])then begin

p:=w;

end;

s[p]:=0;

end;

o:=0;

for q:=1 to x do if s[q]0 then o:=o+1;

writeln(o);

end.

3 条评论

  • @ 2016-07-23 09:01:29

    program knif;
    var
    t,s,i,j,n,m,k:longint;
    a,b:array[1..2000] of longint;
    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 n-1 do
    for j:=i+1 to n do
    if a[i]<a[j] then begin
    t:=a[i]; a[i]:=a[j]; a[j]:=t;
    end;
    for i:=1 to m-1 do
    for j:=i+1 to m do
    if b[i]<b[j] then begin
    t:=b[i]; b[i]:=b[j]; b[j]:=t;
    end;
    for i:=1 to n do
    for j:=1 to m do
    if (a[i]>b[j]) and (b[j]<>0) then
    begin
    b[j]:=0;
    inc(s);
    break;
    end;
    writeln(m-s);
    end.

  • @ 2012-11-08 13:40:29

    需要写这么复杂么?全部读入然后加入板凳高度然后全部比较一边就行了

  • @ 2012-11-08 10:29:47

    manageryzy

    审错题了吧,10行代码就能ac

  • 1

信息

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