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

解释一下啊....~难道添数据了?那也应该rej啊~

Posted by palmtenor at 2005-06-09 18:23:04 on Problem 1159
In Reply To:真是ft到家了,今天某人问我这题,我把我以前ac的程序又交了一边,发现TLE...... Posted by:palmtenor at 2005-06-09 18:22:07
> const
>      maxn=5000;
> var
>      a:array[1..maxn] of char;
>      f1,f2:array[0..maxn] of longint;
>      i,j,k,l,m,n,t,s:longint;
> 
> function max(a,b:longint):longint;
> begin
>  if a>b then max:=a else max:=b;
> end;
> 
> begin
>  readln(n);
>  for i:=1 to n do
>   read(a[i]);
>  readln;
>  fillchar(f1,sizeof(f1),0);
>  fillchar(f2,sizeof(f2),0);
>  for i:=1 to n do begin
>   for j:=1 to n do
>    if a[i]=a[n-j+1] then f2[j]:=f1[j-1]+1 else
>     f2[j]:=max(f2[j-1],f1[j]);
>   f1:=f2;
>  end;
>  writeln(n-f2[n]);
> 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