用python有点耍赖,不过思路差不多
from math import factorial while True: try: n = int(input()) m = p = n if n % 2 == 0: m -= 1 if n % 2 == 1: p -= 1 print(sum(factorial(i) for i in range(1, m+1, 2)), sum(factorial(i) for i in range(2, p+1, 2))) except: break