2388: 方格取数1

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:82 Solved:1

Description

给出一个二维数组m*n的矩阵格,含有非负整数。找出一条路径从最左上角到右下角,使之经过元素之和最小。假定只能向右或向下移动 。

Input

 第一行m,n(m,n<100)是二维数组的行数和列数。 后面m行每行有n个用空格隔开的整数。

Output

  一行,输出最小的经过的数字的总和。

Sample Input Copy

5 4 
3 5 2 9
8 3 12 8 
6 7 2 9 
14 18 24 9 
2 28 19 15  

Sample Output Copy

53