Description
给出一个n*m矩阵,找出行元素最小值中的最大值
Input
第一行两个整数n和m表示矩阵行列数,之后一个n*m矩阵c(1<=n,m<=100,1<=c[i][j]<=10^9)
Output
输出这个矩阵行元素最小值中的最大值
Sample Input
3 4
4 1 3 5
2 2 2 2
5 4 5 1
Sample Output
2
Solution
水题
Code
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
#define INF 0x7f7f7f7f7f
int n,m;
ll c,temp,ans;
int main()
{
while(~scanf("%d%d",&n,&m))
{
ans=0;
for(int i=1;i<=n;i++)
{
temp=INF;
for(int j=1;j<=m;j++)
{
scanf("%I64d",&c);
temp=min(temp,c);
}
ans=max(ans,temp);
}
printf("%I64d\n",ans);
}
return 0;
}