View Code of Problem 85

#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
int main()
{
	int m, n;
	cin >> m >> n;
	int a[100][100];

	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++) {
		int min = a[i][0];
		int col = 0;
		for (int j = 0; j < n; j++) {
			if (min > a[i][j]) {
				min = a[i][j];
				col = j;
			}
		}
		int max = a[0][col];
		for (int k = 0; k < m; k++) {
				if(max < a[k][col]){
					max = a[k][col];
			}
		}
		if (max == min) {
			cout << i+1 << " " << col+1<<endl;
		}
	}
}

Double click to view unformatted code.


Back to problem 85