選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

16 行
268B

  1. import sys
  2. from itertools import combinations
  3. ns = [int(n) for n in sys.stdin.read().splitlines()]
  4. for a, b in combinations(ns, 2):
  5. if a + b == 2020:
  6. print(a * b)
  7. for a, b, c in combinations(ns, 3):
  8. if a + b + c == 2020:
  9. print(a * b * c)