讨论 / 太简单了,一次AC!!!
zengyanjie1999 2011-08-30 07:17:00
点我顶贴 收藏 删除
注意,此程序在超时边缘

program appleandtt;

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

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

begin

readln(n,m);

for i:=1 to n do

readln(apple[i]);

for i:=1 to m do

readln(tt[i]);

num:=m;

for i:=1 to n do

while apple[i]>0 do

begin

dec(apple[i]);

for j:=1 to m do

if (tt[j]=apple[i]) and (tt[j]<>0) then

begin

tt[j]:=0;

apple[i]:=0;

num:=num-1;

end;

end;

writeln(num);

end.

查看更多回复
提交回复