Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

看不出有问题???AC!!!不过下面的数据还是有用的!!

Posted by 1017981912 at 2014-11-30 13:39:35 on Problem 1836
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator