Files
python/TangDou/LuoGuBook/第8章模拟与高精度/P1009_2.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

24 lines
499 B
C++

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
//高精度+高精度
//高精度*低精度
int main() {
int n;
cin >> n;
LL res = 0;
LL f = 1;
for (int i = 1; i <= n; i++) {
// f =i!
// 3!= 3*2*1
// 4!=4*3*2*1
f *= i; //计算i! =(i-1)! * i 举栗子: 4!= 4* 3!
res += f; //计算阶乘的和 res= 1!+2!+3!+...+n!
}
//输出要需要改
cout << res << endl;
return 0;
}