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 |
Re:Re:Re:Re:Re:Re:我靠!我也TLE了In Reply To:Re:Re:Re:Re:Re:Re:我靠!我也TLE了 Posted by:liuweni at 2007-07-24 11:23:24 program p1163(input, output); var a, b : array[1..100] of longint; n, i, j, p : integer; max : longint; begin readln(n); max := -1; fillchar(a, sizeof(a), 0); for i := 1 to n do begin fillchar(b, sizeof(b), 0); for j := 1 to i do begin read(p); if j = 1 then b[j] := a[j]+p else if j = i then b[j] := a[j-1]+p else begin if a[j]>a[j-1] then b[j] := a[j]+p else b[j] := a[j-1]+p; end; if b[j]>max then max := b[j]; end; a := b; end; writeln(max); end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator