Advertisement
Josif_tepe

Untitled

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