#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { int m,n,i,j,max,min; scanf("%d %d",&m,&n); int a[m][n]; for(i=0;i<m;i++){ for(j=0;j<n;j++){ scanf("%d",&a[i][j]); } } min=0,max=0; for(i=0;i<m;i++){ for(j=0;j<n;j++){ if(a[i][min]>a[i][j]){ min=j; } if(a[max][j]<a[i][j]){ max=i; } } } printf("%d %d",max+1,min+1); } |
Double click to view unformatted code.