scripts/ege/Вариант ДЗ/8.py

15 lines
314 B
Python
Raw Normal View History

2023-05-15 13:25:06 +03:00
from itertools import chain, combinations, permutations
def all_subsets(ss):
return chain(*map(lambda x: combinations(ss, x), range(0, len(ss) + 1)))
c = 0
for subset in all_subsets(list(range(1, 10))):
if sum(subset) == 10:
c += len(list(permutations(subset)))
print(subset)
print(c)