| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
看不出有问题???AC!!!不过下面的数据还是有用的!!var
f1,f2:array[1..1000] of longint;
soldier:array[1..1000] of real;
n,i,j,max,flag:longint;
begin
readln(n);
for i:=1 to n do
begin
f1[i]:=1;
f2[i]:=1;
read(soldier[i]);
end;
for i:=2 to n do
for j:=1 to i-1 do
if (soldier[i]>soldier[j]) and (f1[j]+1>f1[i]) then
f1[i]:=f1[j]+1;
for i:=n-1 downto 1 do
for j:=n downto i+1 do
if (soldier[i]>soldier[j]) and (f2[j]+1>f2[i]) then
f2[i]:=f2[j]+1;
max:=0;
for i:=1 to n do
for j:=i to n do
begin
if i=j then flag:=1
else flag:=0;
if max<f1[i]+f2[j]-flag then
max:=f1[i]+f2[j]-flag;
end;
writeln(n-max);
end.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator