В каждой клетке таблицы 3 × 5 стоит натуральное чи...
Creato il: 4 novembre 2025
Creato il: 4 novembre 2025
В каждой клетке таблицы 3 × 5 стоит натуральное число. При этом все числа различны, но
суммы во всех строках одинаковы и во всех столбцах тоже одинаковы. Какова минимально
возможная сумма чисел в таблице?
pythonimport itertools nums=list(range(1,16)) triples=[t for t in itertools.combinations(nums,3) if sum(t)==24] len(triples), triples[:10] (25, [(1, 8, 15), (1, 9, 14), (1, 10, 13), (1, 11, 12), (2, 7, 15), (2, 8, 14), (2, 9, 13), (2, 10, 12), (3, 6, 15), (3, 7, 14)])
pythontriples_set=[set(t) for t in triples] solutions=[] def search(remaining, start, current): if not remaining: solutions.append(current.copy()); return # select smallest remaining element to reduce branching s=min(remaining) # choose triples containing s for i, t in enumerate(triples_set): if s in t and t<=remaining: current.append(t) search(remaining - t, i+1, current) current.pop() remaining=set(nums) search(remaining, 0, []) len(solutions) 11
pythonsolutions[:2] [[{1, 8, 15}, {2, 9, 13}, {3, 10, 11}, {4, 6, 14}, {5, 7, 12}], [{1, 8, 15}, {2, 10, 12}, {3, 7, 14}, {4, 9, 11}, {5, 6, 13}]]
pythonimport itertools, math def find_row_assignment(partition): part=[tuple(sorted(list(s))) for s in partition] # triples # Try all permutations per column (3!^5=243) manageable for perms in itertools.product(itertools.permutations((0,1,2)), repeat=5): rows=[0,0,0] ok=True for col, triple in enumerate(part): perm=perms[col] for idx,row in enumerate(perm): rows[row]+=triple[idx] if rows==[40,40,40]: # build grid grid=[[None]*5 for _ in range(3)] for col,triple in enumerate(part): perm=perms[col] for idx,row in enumerate(perm): grid[row][col]=triple[idx]
Короткий ответ: 120.
Почему так.
Всего 15 различных натуральных чисел. Чтобы сумма была минимальной, берём самые маленькие: . Их сумма равна
Если получится разложить их в таблицу так, чтобы суммы строк были одинаковыми (= ) и суммы столбцов тоже одинаковыми (= ), то искомый минимум равен 120.
Такое разложение существует, например:
Здесь суммы строк: ; суммы столбцов: .
Значит, минимально возможная сумма чисел в таблице — 120.