python 鞍点
2020-12-13 16:49
标签:break 5* and col python dom lag step max python 鞍点 标签:break 5* and col python dom lag step max 原文地址:https://www.cnblogs.com/jiaxinwei/p/11621877.html# 鞍点: 所在行的最大值,所在列的最小值
import random
A = [[random.randint(1,100) for j in range(5)]for i in range(5)] #生成5*5随机数组
# print(A)
for row in range(5):
max = A[row][0]
maxcol = 0 #初始化
#step1 每行最大元素的列
for col in range(1,5):
if A[row][col]>max:
maxcol = col
# print(maxcol)
#step2 该数是否为此列最小的值
flag = True
for r in range(5):
if A[r][maxcol]