有沒有大佬幫忙看看我這哪錯了啊,大一學生練習題

using System;using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 找鞍點
{
class Program
{
static void Main(string[] args)
{
int n = int.Parse(Console.ReadLine());
int[,] ar = new int[n, n];
int a, b, c, d, x = 0;
int[] max = new int[n];
int[] min = new int[n];
bool flag = false; ;
for (int i = 0; i < n; i++)
{
int[] arr = new int[n];
arr = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
for (int j = 0; j < n; j++)
ar[i, j] = arr[j];
}
for (a = 0; a < n; a++)
{
int max1 = ar[a, 0];
for (b = 1; b < n; b++)
{
if (max1 < ar[a, b])
{
max1 = ar[a, b];
max[a] = b;
}
}
}
for (c = 0; c < n; c++)
{
x = ar[c, max[c]];
for (d = 1; d < n; d++)
{
if (x >= ar[d, max[c]])
{
x = ar[d, max[c]];
min[c] = d;
}
}
if (min[c] == c)
{
flag = true;
Console.WriteLine(c + " " + max[c]);
}
}
if (flag == false)
{
Console.WriteLine("NONE");
}
Console.ReadLine();
}
}
}
uj5u.com熱心網友回復:
行中最大列中最小,首先找行最大,再找列中最小。轉載請註明出處,本文鏈接:https://www.uj5u.com/net/201993.html
標籤:C#
上一篇:用企業微信來驗證登錄
