# input
matrix = []
line = list(map(int, input().split()))
matrix.append(line)
for j in range(len(line) - 1):
print(matrix)
# k + max
k = int(input("k: "))
maximum = matrix[0][0]
counter = 0
for arr in matrix:
for num in arr:
if num % k == 0:
if maximum < num:
maximum = num
counter += 1
print("{0} чисел, кратных {1}".format(counter, k))
if maximum != 0:
print("Максимальное число кратное {0} - {1}".format(k, maximum))
else:
print("Нет чисел кратных {0}".format(k))
matrix = input().split("],[")
matrix[0] = matrix[0][1:]
matrix[len(matrix) - 1] = matrix[len(matrix)-1][:len(matrix[len(matrix) - 1])-1]
newMatrix = []
line = list(map(int, arr.split(",")))
newMatrix.append(line)
matrix = newMatrix
# input
matrix = []
line = list(map(int, input().split()))
matrix.append(line)
for j in range(len(line) - 1):
line = list(map(int, input().split()))
matrix.append(line)
print(matrix)
# k + max
k = int(input("k: "))
maximum = matrix[0][0]
counter = 0
for arr in matrix:
for num in arr:
if num % k == 0:
if maximum < num:
maximum = num
counter += 1
print("{0} чисел, кратных {1}".format(counter, k))
if maximum != 0:
print("Максимальное число кратное {0} - {1}".format(k, maximum))
else:
print("Нет чисел кратных {0}".format(k))
Если одной строкой, уже массивом ([1,20,3,4],[2,5,5,5],[3,8,9,12],[8,9,10,11])# input
matrix = input().split("],[")
matrix[0] = matrix[0][1:]
matrix[len(matrix) - 1] = matrix[len(matrix)-1][:len(matrix[len(matrix) - 1])-1]
newMatrix = []
for arr in matrix:
line = list(map(int, arr.split(",")))
newMatrix.append(line)
matrix = newMatrix
print(matrix)
# k + max
k = int(input("k: "))
maximum = matrix[0][0]
counter = 0
for arr in matrix:
for num in arr:
if num % k == 0:
if maximum < num:
maximum = num
counter += 1
print("{0} чисел, кратных {1}".format(counter, k))
if maximum != 0:
print("Максимальное число кратное {0} - {1}".format(k, maximum))
else:
print("Нет чисел кратных {0}".format(k))