View Code of Problem 85

#include<iostream>
#include<algorithm>
using namespace std;

int main(){
	int m,n;
	int p;
	scanf("%d %d",&m,&n);
	int ans[100][100]={0};
	//输入数组 
	for(int i=0;i<m;i++){
		for(int j=0;j<n;j++){
			scanf("%d",&ans[i][j]);
		}
	} 
	int max=0;
	int min=0;
	//然后遍历进行比较
	for(int i=0;i<m;i++){
		//找出i行元素的小值 
		for(int j=0;j<n;j++){
			
			if(ans[i][min]>ans[i][j]){
				min=j;
			}
		}
		//然后看最小元素是否为该列的最大值 
		for(p=0;p<m;p++){
			if(ans[p][min]>ans[i][min]){
				break; 
			}
			//比到头了还是没发现比他大的 
		
		} 
			if(p==m){
				printf("%d %d",i+1,min+1);
			}
			min=0;
	} 
	
	
	  return 0;
    }

Double click to view unformatted code.


Back to problem 85