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 |
WA得疯掉了,跪求高手指教!!!const maxn=10; 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator