Advent of code 2015 solutions https://adventofcode.com/2015/
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456
  1. from itertools import combinations
  2. with open('17.txt', 'r') as file:
  3. lines = map(int, file.readlines())
  4. count = [[sum(c) for c in combinations(lines, n + 1)].count(150) for n in range(len(lines))]
  5. print("Total: %s Minimum: %s" % (sum(count), next(x for x in count if x)))