Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int n,m, a[105][105];
- int main()
- {
- cin >> n >> m;
- for(int i = 1 ; i <= n ; ++i)
- for(int j = 1; j <= m ; ++j)
- cin >> a[i][j];
- for(int i = 1 ; i <= n ; ++i)
- {
- int s = 0, max = a[i][1];
- for(int j = 1 ; j <= m ; ++j)
- {
- s += a[i][j];
- if(a[i][j] > max)
- max = a[i][j];
- }
- cout << s - max << " ";
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment