# 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
не так уж и трудно, если
program project2;
var
n,a,b,c,i,k,max,min: longint;
inp,outp: text;
begin
assign(inp,'input.txt');
reset(inp);
assign(outp,'output.txt');
rewrite(outp);
readln(inp,n);
max: =0;
min: =0;
c: =0;
for i: =1 to n do
read(f1,a);
if i=1 then
b: =a;
if a> max then
max: =a;
k: =a-c;
c: =a;
if k< 0 then
k: =abs(k);
min: =min+k;
if k> min then
min: =k;
end;
max: =max-b;
write(outp,max,' ',min);
close(inp);
close(outp);
end.
# 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))
не так уж и трудно, если
program project2;
var
n,a,b,c,i,k,max,min: longint;
inp,outp: text;
begin
assign(inp,'input.txt');
reset(inp);
assign(outp,'output.txt');
rewrite(outp);
readln(inp,n);
max: =0;
min: =0;
c: =0;
for i: =1 to n do
begin
read(f1,a);
if i=1 then
b: =a;
if a> max then
max: =a;
k: =a-c;
c: =a;
if k< 0 then
begin
k: =abs(k);
min: =min+k;
if k> min then
min: =k;
end;
end;
max: =max-b;
write(outp,max,' ',min);
close(inp);
close(outp);
end.