这,这,这怎么回事

呵呵,老是错,代码如下:
var n,m,p,l,k,v,d:longint;
a:array[1..2000] of longint;
b:array[1..2000] of longint;
begin
d:=0;
read(n,m);
begin
for i:=1 to n do
read(a[i]);
end;
begin
for k:=1 to m do
read(b[k]);
end;
begin
for p:=1 to n do
begin
for l:=1 to m do
if p[l]=0 then continue;
if a[p]>b[l] then b[l]:=0;
end;
end;
begin
for v:=1 to m do
if b[v]=0 then continue else
d:=d+1;
end;
write(d);
end.

6 条评论

  • @ 2017-07-15 13:36:21

    半年前就AC的.

    var
      apple, taotao:array[1..2000] of longint;
      n, m, i, j, p, max, s:longint;
    begin
      readln(n, m);
      for i:=1 to n do readln(apple[i]);
      for i:=1 to m do readln(taotao[i]);
      s:=0;
      for i:=1 to n do begin
        p:=0;
        max:=0;
        for j:=1 to m do if (taotao[j]<apple[i]) and (taotao[j]>max) then begin
          p:=j;
          max:=taotao[j]
        end;
        if p<>0 then begin
          inc(s);
          taotao[p]:=0
        end;
      end;
      write(m-s)
    end.
    
  • @ 2017-07-14 19:55:48

    P不用转C?

  • @ 2017-05-06 16:10:25

    var
    n,m,i,j,q,d: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:=1 to m-i do
    if b[j]>b[j+1] then begin
    d:=b[j];
    b[j]:=b[j+1];
    b[j+1]:=d;
    end;
    i:=0; q:=0;
    repeat
    inc(i);
    for j:=m downto 1 do
    if (a[i]>b[j])and(b[j]<>-1)and(b[j]<>0) then
    begin
    inc(q);
    b[j]:=-1;
    break;
    end;
    until i=n;
    q:=m-q;
    writeln(q);
    end.

  • @ 2016-12-15 20:50:18

    c++路过

  • @ 2016-12-15 20:38:26

    求回复!

  • @ 2016-12-15 20:38:00

    还有人用pascal吗?

  • 1

信息

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