Problem list
Log in
#r03334 · Online Judge > GoldOJ

Maximum Path Sum in Grid

Silver II 2.0 s 1024 MB

On an $N \times N$ grid of positive integers you move only right or down from $(1,1)$ to $(N,N)$. Print the maximum possible sum of the cells on a path.

Input

First line $N$ ($1 \le N \le 500$); then $N$ rows of $N$ integers, each in $[1, 1000]$.

Output

Print the maximum path sum.

Example 1

Input
3
1 3 2
2 5 1
4 2 1
Output
12
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 1 Submissions 2 Acceptance 100% Solvers 1

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code