Created
January 21, 2017 04:20
-
-
Save asuka-mirai/cc44687dc2bc88299b0819f5d8ea8450 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools as it | |
from collections import Counter | |
l = [1,14,14,4,11,7,6,9,8,10,10,5,13,2,3,15] | |
ans = [] | |
for i in range(len(l)): | |
for d in it.combinations(l,i): | |
ans.append(sum(d)) | |
counter = Counter(ans) | |
for num, cnt in counter.most_common(): | |
print(num, cnt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment