Advertisement
Guest User

Task C

a guest
Apr 20th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.     int ar[100][100];
  7.     int tot[100];
  8.     int n, m;
  9.     cin >> n >> m;
  10.     int maxind = 0;
  11.     for(int i = 0; i < n; i ++){
  12.         tot[i] = 0;
  13.         for(int j = 0; j < m; j ++){
  14.             cin >> a[i][j];
  15.             tot[i] += a[i][j];
  16.         }
  17.         if(tot[maxind] < tot[i])
  18.             maxind = i;
  19.     }
  20.     cout << tot[maxind] << endl;
  21.     cout << maxind;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement