fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a[100][100];
  6. int n,m;
  7. cin >> n >> m;
  8. for(int i = 0;i < n;i++)
  9. {
  10. for(int j = 0;j < m;j++)
  11. {
  12. cin >> a[i][j];
  13. }
  14. }
  15. int maxv = a[0][0];
  16. for(int i = 0;i < n;i++)
  17. {
  18. for(int j = 0;j < m;j++)
  19. {
  20. if(a[i][j] > maxv)
  21. {
  22. maxv = a[i][j];
  23. }
  24. }
  25.  
  26. }
  27. cout << maxv << endl;
  28. return 0;
  29. }
Success #stdin #stdout 0s 5304KB
stdin
4 3
5 6 7
2 3 5
7 2 4
9 1 3
stdout
9