feng_chenShy @ 2024-02-11 11:28:59
#include<bits/stdc++.h>
using namespace std;
int n;
unsigned long long s=0;
long long cf(int n)
{
long long a=1;
for(int i=n;i>=1;i--)
a*=i;
return a;
}
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
s+=cf(i);
}
cout<<s<<endl;
return 0;
}
我用的是暴力枚举,不知道是不是TLE了
by DFs_YYDS @ 2024-02-11 11:31:22
@18762057392spx 好像需要用高精
by feng_chenShy @ 2024-02-11 11:48:22
@DFs_YYDS
换成double后还是50分
by Limitless_lmw @ 2024-02-11 11:53:05
@18762057392spx 请自行查阅相关知识高精度,和什么 double 没关系
https://oi-wiki.org/math/bignum/
by wanderer___ @ 2024-02-11 12:30:20
@18762057392spx 要用高精加
by feng_chenShy @ 2024-02-11 12:31:53
知道了!谢谢各位大佬