计算鞍点

来源:互联网 发布:淘宝买完东西店铺没了 编辑:程序博客网 时间:2024/05/20 04:31





参考代码:
#include <iostream>#include <string>using namespace std;int main(){int a[5][5];int m[5],q[5];    int p[5]={1,1,1,1,1};    for(int i=0;i<5;i++)    {    q[i]  = 0;       for (int j =0 ; j<5 ; j++)       {         cin >> a[i][j];         if (a[i][j] > q[i])         {   q[i] = a[i][j];         m[i] = j;         }       }    }    for (int b = 0;b <5;b++)    {    for (int c = 0; c< 5;c++)    {    if (a[c][m[b]] < a[b][m[b]])    {    p[b] = 0;break;    }    }    }    string x = "not found";    for (int d = 0;d<5;d++)    {    if (p[d] == 1)    {    printf("%d %d %d", d+1,m[d]+1,a[d][m[d]]);x = "found";    }    }    if (x == "not found")    {    cout << x;    }    return 0;}


原创粉丝点击