var l,w,fz:array [0..10010] of longint;
n,i,j,t,ans:longint;
begin
readln(n);
for i:=1 to n do read(l[i],w[i]);
for i:=1 to n-1 do
for j:=i+1 to n do
if (l[i]>l[j]) or (l[i]=l[j]) and (w[i]>w[j]) then
begin
t:=l[i];l[i]:=l[j];l[j]:=t;
t:=w[i];w[i]:=w[j];w[j]:=t;
end;
for i:=1 to n do
begin
j:=1;
while fz[j]>w[i] do inc(j);
if j>ans then inc(ans);
fz[j]:=w[i];
end;
writeln(ans);
end.
这道题的步骤:
1:排序。长度冲小到大排序,长度相等按重量。
2:分组。按题目要求找集合。
转载请注明原文地址: https://ju.6miu.com/read-1000045.html