n = int(input("请输入想要计算的 n : ")) ans = 0 # 储存答案 to_mul = 1 # 计算阶乘的中间量,会储存 (n-1)! for i in range(n): to_mul *= (i+1) ans += to_mul print(ans)