题解 | #最高身高#
最高身高
http://www.nowcoder.com/practice/258fe0c567ac493f9b7bc9d3669d158d
#include<stdio.h>
#include<malloc.h>
int main(void)
{
int n,m;
int **height;
int max=0;
int t=-1,p=-1;//定义两个变量用来存放最大值时的下标值
scanf("%d %d",&n,&m);
height=(int **)malloc(sizeof(int *)*n);
for(int i=0;i<n;i++)
height[i]=(int *)malloc(sizeof(int)*m);
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
{
scanf("%d",&height[i][j]);
max=max>height[i][j]?max:height[i][j];
if(max==height[i][j])//用于记录最大值的下标值
{
t=i;
p=j;
}
}
printf("%d %d",t+1,p+1);
return 0;
}