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.

5 年之前
5 年之前
1234567891011121314
  1. import sys
  2. text = sys.stdin.read()
  3. ns = [int(s) for s in text.splitlines()]
  4. def handle(n):
  5. m = n // 3 - 2
  6. return [m] + handle(m) if m > 0 else []
  7. print(sum(handle(n)[0] for n in ns))
  8. print(sum(sum(handle(n)) for n in ns))