mirror of
https://github.com/Alexander-D-Karpov/scripts.git
synced 2024-11-29 06:43:43 +03:00
15 lines
314 B
Python
Vendored
15 lines
314 B
Python
Vendored
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)
|