View Code of Problem 85

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

Double click to view unformatted code.


Back to problem 85