- 合唱队形
- 2009-10-26 13:15:05 @
var
p,n,i,j,k,max1,max2,min:integer;
t,f:array[0..101]of integer;
begin
readln(n);
min:=1000;
for i:=1 to n do
read(t[i]);
for i:=2 to n-1 do
begin
for j:=0 to n+1 do
f[i]:=1;
for j:=2 to i-1 do
for k:=1 to j-1 do
if (t[k]f[j]) then
f[j]:=f[k]+1;
max1:=f[j];
f[i]:=1;
for j:=n-1 downto i do
for k:=n downto j+1 do
if (t[j]>t[k]) and (f[k]+1>f[j])
then f[j]:=f[k]+1;
if min>n-max1-f[j] then min:=n-max1-f[j];
end;
writeln(min);
end.
end.
2 条评论
-
765583617 LV 4 @ 2015-06-29 17:10:26
ha ha ha ha ha
-
2009-10-26 14:45:30@
...
if (t[k]f[j]) then
if (t[j]>t[k]) and (f[k]+1>f[j])
这两行有一个写错了
- 1