Input
The first line has a number k(0<k<20), where k means there are k groups of test data. In the following lines,
input the test data that are separated by one blank line. In each group, the test data is organized as follows:
1. The first line includes two positive integers: m(1<m<30) and n(1<n<30), representing the 2-dimensional array
has m rows and n columns.
2. The following m lines include the element values of the 2-dimensional array. Each line has n values separated
by one blank space.
Output
There are k results for all test data. One result per line. If there are several peak points, each two are separated by blank space. If there is no peak point, please display NO.
Sample Input
2
3 3
1 2 3
4 5 6
7 8 9
2 2
9 8
4 10
3 3
1 2 3
4 5 6
7 8 9
2 2
9 8
4 10
Sample Output
9
9 10
9 10
#include <stdio.h>
int main()
{
int k,i,j,a[30][30],m,n,b,c,t,max,f;
scanf("%d",&k);
for(c=0;c<k;c++)
{scanf("%d%d",&m,&n);
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
for(i=0;i<m;i++)
{max=a[i][0];
b=0;
for(j=1;j<n;j++)
if(a[i][j]>max)
{max=a[i][j];
b=j;}
f=1;
for(t=0;t<m;t++)
if(max<a[t][b])
{f=0;
break;}
if(f==1)
printf("%d\n",max);}
if(f==0)
printf("no\n");
}
return 1;
}