Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

il y a 4 ans
12345678910111213141516171819202122
  1. import sys
  2. from itertools import combinations
  3. text = sys.stdin.read()
  4. ns = [int(n) for n in text.splitlines()]
  5. for i, n in enumerate(ns):
  6. if i >= 25 and n not in {a + b for a, b in combinations(ns[:i][-25:], 2)}:
  7. ans1 = n
  8. print(ans1)
  9. i, j, s = 0, 0, ns[0]
  10. while s != ans1:
  11. if s < ans1:
  12. j += 1
  13. s += ns[j]
  14. elif s > ans1:
  15. s -= ns[i]
  16. i += 1
  17. ans2 = min(ns[i:j]) + max(ns[i:j])
  18. print(ans2)