Lucian_Adrian

#659 SumaLinii1

Jan 18th, 2022
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int n,m, a[105][105];
  5.  
  6. int main()
  7. {
  8.     cin >> n >> m;
  9.     for(int i = 1 ; i <= n ; ++i)
  10.         for(int j = 1; j <= m ; ++j)
  11.             cin >> a[i][j];
  12.    
  13.     for(int i = 1 ; i <= n ; ++i)
  14.     {
  15.         int s = 0, max = a[i][1];
  16.         for(int j = 1 ; j <= m ; ++j)
  17.         {
  18.             s += a[i][j];
  19.             if(a[i][j] > max)
  20.                 max = a[i][j];
  21.         }
  22.         cout << s - max << " ";
  23.     }
  24.     cout << endl;
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment