杭电oj海选女主角

版权声明:https://blog.csdn.net/qq_43129582/article/details/83213278 https://blog.csdn.net/qq_43129582/article/details/84071648

Input

输入数据有多组,每组的第一行是两个整数m和n,表示应聘MM的总共的行列数,然后是m行整数,每行有n个,m和n的定义见题目的描述。

Output

对于每组输入数据,输出三个整数x,y和s,分别表示选中的MM的行号、列号和分数。
note:行号和列号从一开始,如果有多个MM的分数绝对值一样,那么输出排在最前面的一个(即行号最小的那个,如果行号相同则取列号最小的那个)。

Sample Input

2 3 1 4 -3
-7 3 0

Sample Output

2 1 -7

#include<iostream>
 #include<cmath>
 using namespace std;
 int main()
 {
 	int n,m;
 	int a[100][100];
 
 	int b=0,c=0,max;
 	while(cin>>n>>m)
 	{
 		for(int i=1;i<=n;i++)
 		
 			for(int j=1;j<=m;j++)
 			{
 				cin>>a[i][j];
			 }
		
			  max=a[1][1];
			  for(int i=1;i<=n;i++)
			  for(int j=1;j<=m;j++)
			  	if(abs(a[i][j])>abs(max))
			 {
			 
			 	max=a[i][j];
			 	b=i;
			 	c=j;
			 }
			 	
			 
		 cout<<b<<" "<<c<<" "<<max<<endl;
	  
	
	 }
	 
	 return 0;
 	
  } 

猜你喜欢

转载自blog.csdn.net/qq_43129582/article/details/84071648
今日推荐