2 3 1 4 -3 -7 3 0
2 1 -7
去年acm成员选拔做的。。
#include <stdio.h>
#include <algorithm>
#include <math.h>
#define N 100000
using namespace std;
bool cmp(int x,int y)
{
return fabs(x)>fabs(y);
}
int main()
{
int m,n,j,i,s;
int a[100][1000],b[N];
while(scanf("%d%d",&m,&n)!=EOF)
{
s=0;
for(i=0;i<m;i++)
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
b[s]=a[i][j];
s++;
}
sort(b,b+s,cmp);
for(i=0;i<m;i++)
for(j=0;j<n;j++)
{
if(b[0]==a[i][j])
{
printf("%d %d %d",i+1,j+1,a[i][j]);
goto stop;
}
}
stop:
printf("\n");
}
return 0;
}版权声明:本文为博主原创文章,未经博主允许不得转载。
原文:http://blog.csdn.net/su20145104009/article/details/47271497