找鞍点
2008-03-08 12:24:28 来源:WEB开发网核心提示:#define N 5main(){int i,j,x,y,boolean;int arry[N][N];boolean=0; PRintf("please input %d nums: ",N*N);for (i=0;i<N;i++) for(j=0;j<N;j++) {printf
#define N 5
main(){
int i,j,x,y,boolean;
int arry[N][N];
boolean=0;
PRintf("please input %d nums: ",N*N);
for (i=0;i<N;i++)
for(j=0;j<N;j++)
{printf("arry[%d][%d]=",i,j);
scanf("%d",&arry[i][j]);
printf(" ");}
for (x=0;x<N;x++)
{int max,ymax;
ymax=0;
max=arry[x][0];
for (y=1;y<N;y++)
{
if (max<arry[x][y])
{max=arry[x][y];
ymax=y;
}
}
if (lie(arry,x,ymax,arry[x][ymax])==1)
{printf("the andian is arry[%d][%d]=%d ",x,ymax,arry[x][ymax]);
boolean=1;}
}
if (boolean!=1)
printf("No existence!");
}
int lie(int arry[N][N],int x,int y,int z) /*列方向的判定*/
{int i;
for (i=0;i<N;i++)
{if ((i!=x)&&(z>arry[i][y]))
return(-1);
}
return(1);
}
[]
- ››找鞍点
更多精彩
赞助商链接