禹天钧2016 @ 2024-04-30 17:40:28
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, s2 = 1, s1 = 0;
cin >> n;
for (long long i = 1; i <= n; i++) {
s2 = s2 * i;
s1 += s2;
}
cout << s1;
return 0;
}
??? 必关!!!
by Henry2012 @ 2024-04-30 17:44:15
如果希望通过本题,请继续学习第八章高精度的知识。
by toolazy @ 2024-04-30 17:45:14
用高精度计算
S=1!+2!+3!+\cdots+n!
by ToMaT @ 2024-04-30 18:47:42
@禹天钧2016 数据范围超出long long , 用高精加和高精乘
by 禹天钧2016 @ 2024-04-30 19:05:41
???
by liboya5074 @ 2024-04-30 20:22:43
@禹天钧2016 因为后面几个点的数据十分大,导致爆 long long
,需要用高精度方法。
当然也可以用 Python
(doge)
by 禹天钧2016 @ 2024-05-01 11:02:01
我不会高精度呀!!!
by ToMaT @ 2024-05-05 07:57:50
想多拿点分可以在定义时把long long 改成无符号long long
by ToMaT @ 2024-05-05 07:58:10
@禹天钧2016
by 禹天钧2016 @ 2024-05-05 12:41:01
@ToMaT ???
by ToMaT @ 2024-05-05 15:59:58
无符号long long 我试了,也AC不了