View Code of Problem 85

#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f

int main(){
	int hang,lie,shuju[100][100] = { };
	int pos = 0,min ,max = 0,op;
	cin>>hang>>lie;
	for(int i = 0;i<hang;i++){   //输入数据 
		for(int j = 0;j<lie;j++)
			cin>>shuju[i][j];
	}
	
	
	for(int i = 0;i<hang;i++){
		min = inf;
		for(int k = 0;k<lie;k++){   //找到某一行的最小值下标 
			if(shuju[i][k] < min){
				min = shuju[i][k];
				pos = k;
			}
		}
//		cout<<pos<<endl;	
		//min 是 某一行的最小值 
		for( op = 0;op<hang;op++){
			if(shuju[op][pos] > min ) break;
			else if(shuju[op][pos]==min) max = op; 
		}
//		cout<<max;
		if(op==hang)cout<<max+1<<" "<<pos+1<<endl;
}
	
	return 0;
}

Double click to view unformatted code.


Back to problem 85