UTPC2011 A: プログラミングコンテスト
解法
やるだけ。O(N+M)。
#include <cstdio> #include <algorithm> using namespace std; int main(){ int ret = 0; int n, m; scanf("%d%d",&n,&m); for(int i=0; i<n; i++){ int t = 0; for(int j=0; j<m; j++){ int x; scanf("%d",&x); t += x; } ret = max(ret, t); } printf("%d\n",ret); return 0; }