STANAANDREY

sb prog 15

Feb 24th, 2022 (edited)
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream fin("graf.in");
  5. int n, a[51][51], gr[51];
  6.  
  7. int main() {
  8.     fin >> n;
  9.     for (int i = 1; i <= n; i++) {
  10.         for (int j = 1; j <= n; j++) {
  11.             fin >> a[i][j];
  12.         }
  13.     }
  14.  
  15.     int maxi = 0;
  16.     for (int i = 1; i <= n; i++) {
  17.         int sum = 0;
  18.         for (int j = 1; j <= n; j++) {
  19.             sum += a[i][j];
  20.         }
  21.  
  22.         if (sum > maxi) {
  23.             maxi = sum;
  24.         }
  25.  
  26.     }
  27.  
  28.     cout << maxi << endl;
  29.     return 0;
  30. }
  31.  
Add Comment
Please, Sign In to add comment