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

Re:WA得疯掉了,跪求高手指教!!!

Posted by xxxgg at 2009-12-27 13:21:47 on Problem 1157
In Reply To:WA得疯掉了,跪求高手指教!!! Posted by:xxxgg at 2009-12-27 13:16:19
发错了。。。
 const
>   maxn=1000;
> var
>   a,f:array[0..maxn,0..maxn] of longint;
>   n,m,i,j,ans:longint;
> function max(a,b:longint):longint;
> begin
>   max:=a;
>   if max<b then max:=b;
> end;
> begin
>    while not eof do
>     begin
>        readln(n,m);
>        for i:=1 to n do
>         for j:=1 to m do
>            begin
>               read(a[i,j]);
>            end;
>       for i:=0 to n+1 do
>         for j:=0 to m+1 do
>           f[i,j]:=-10000000;
>     for i:=1 to n do
>       f[0,i]:=0;
>     f[0,0]:=0;
>    for i:=1 to n do
>       f[i,i]:=f[i-1,i-1]+a[i,i];
>    for i:=1 to n do
>        for j:=1 to m do
>            f[i,j]:=max(f[i,j-1],f[i-1,j-1]+a[i,j]);
>      writeln(f[n,m]);
>    end;
> 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