50分求救

P1009 [NOIP1998 普及组] 阶乘之和

Eagle2012 @ 2024-07-12 19:11:14

#include<bits/stdc++.h>
using namespace std;

long long n, ans = 1,s = 0;
int main(){
    cin>>n;
    for(int i = 1;i <= n;i++){
        ans = 1;
        for(int j = 1;j <= i;j++){
            ans*=j;
        }
        s+=ans;
    }

    cout<<s;
    return 0;
} 

by Ellen_Joe @ 2024-07-12 19:16:02

需要高精度


by Bitwise_Operation @ 2024-07-12 19:54:48

@Eagle2012 没看tag吗?要高精啊喂!


by Eagle2012 @ 2024-07-12 19:56:13

@Ellen_Joe 谢谢大佬!


by Eagle2012 @ 2024-07-12 19:56:23

@Bitwise_Operation 谢谢大佬!


|