#include<iostream> #include<algorithm> #include<math.h> #include<stdio.h> #include<stdlib.h> #include<string.h> #include<cstring> #include<string> using namespace std; struct hs{ int x; int y; }; int main() { int n,m,min,minp,max,maxp,len=0; cin>>m>>n; bool f=true; int a[m][n]; hs h[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++) { for(int j=0;j<n;j++) { if(j==0) { minp=j; min=a[i][j]; } else{ if(a[i][j]<min) { min=a[i][j]; minp=j; } } } for(int j=0;j<m;j++) { if(j==0) { max=a[j][minp]; maxp=j; } else{ if(a[j][minp]>max) { max=a[j][minp]; maxp=j; } } } if(max==min) { h[len].x=maxp+1; h[len].y=minp+1; len++; } } for(int i=0;i<len;i++) { if(f) { f=false; cout<<h[i].x<<" "<<h[i].y; } else cout<<" "<<h[i].x<<" "<<h[i].y; } return 0; } |
Double click to view unformatted code.