题解 | #阶乘#
阶乘
https://www.nowcoder.com/practice/e58c8a55162d49c48115bdfa5da7da56
用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