输入样例:
3 2
6 3
1 -8
3 12
输出样例:
9
-7
15
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int m, n;
cin >> m >> n;
int *a =new int[m];
for (int i = 0; i < m; i++)
{
int sum = 0;
for (int j = 0; j < n; j++)
{
int tmp;
cin >> tmp;
sum += tmp;
}
a[i] = sum;
}
for (int i = 0; i < m; i++)
cout << a[i] << endl;
delete[]a;
return 0;
}