fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, m;
  6. cin >> n >> m;
  7. int a[n][m];
  8. int max = INT_MIN;
  9. int cot = -1;
  10. for (int i = 0; i < n; i++) {
  11. for (int j = 0; j < m; j++) {
  12. cin >> a[i][j];
  13. }
  14. }
  15.  
  16. for (int j = 0; j < m; j++) {
  17. int s = 0;
  18. for (int i = 0; i < n; i++) {
  19. s += a[i][j];
  20. }
  21.  
  22. if (max < s){
  23. max = s;
  24. cot = j;
  25. }
  26. }
  27. cout << cot + 1 << endl;
  28. cout << max << endl;
  29.  
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 5304KB
stdin
3 3
1 2 3 
4 5 6
7 8 9
stdout
3
18