# 小胖学长山洞探险

``````4 4
1 2 3 4
5 6 7 9
8 10 11 23
56 22 23 40``````

``56``

``````#include<math.h>
#include<stdio.h>
//#include<algorithm>
int main()
{
int a[20][20];
int n,m;
scanf("%d %d",&n,&m);
for(int i = 0; i<n; i++)
for(int j = 0; j<m; j++)
scanf("%d",&a[i][j]);
int Max=a[0][0];
for(int i = 0; i<n; i++)
for(int j = 0; j<m; j++)
if(a[i][j] >= Max)
Max = a[i][j];
printf("%d",Max);
return 0;
}
``````

``````#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iostream>
#include <cstdlib>
#include <map>
#include <list>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
#define sf scanf
#define pf printf
#define mt(a) memset(a,0,sizeof a)

const int maxn = 50010;
const int inf=0x3f3f3f3f;
typedef long long ll;
int gcd(int a, int b){return b?gcd(b,a%b):a;}
typedef unsigned long long ull;

num=0;T f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
num*=f;
}
int sqr(int x) {return x * x;}
void chmin(int &a, int b) {a = (a < b ? a : b);}
void chmax(int &a, int b) {a = (a > b ? a : b);}
int main()
{
int max = -1000;
int m,n,x;
cin>>n>>m;
for(int i = 0;i < n;i++)
for(int j = 0;j < m;j++)
{
cin>>x;
if(x > max)
max = x;
}
cout<<max;
}
``````