1003: 矩阵选数

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:45 Solved:49

Description

在n行m列的正整数矩阵中,要求从每行中选出1个数,使得选出的总共n个数的和最大

Input

第一行,输入正整数n,m,n表示行数,m表示列数;
第二行开始的n行,每行m个正整数,数之间用空格分开。

Output

一行,一个正整数,为n个数的和的最大值。

Sample Input Copy

3 4
2 4 5 1
9 7 2 6
21 32 8 15

Sample Output Copy

46

Source/Category