You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 jaren geleden
1234567891011121314
  1. def recurse(pending, opts, chain=tuple()):
  2. if pending == 0:
  3. yield chain
  4. else:
  5. for i, opt in enumerate(opts):
  6. yield from recurse(pending - opt, opts[i + 1:], chain + (opt,))
  7. ns = sorted([int(n) for n in df.read_text().splitlines()], reverse=True)
  8. opts = list(recurse(150, ns))
  9. ans1 = len(opts)
  10. min_n = min(map(len, opts))
  11. ans2 = sum(len(opt) == min_n for opt in opts)