50pts,help

P1009 [NOIP1998 普及组] 阶乘之和

jfy2204 @ 2023-05-27 21:12:15

#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n,s=1,s2=0;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=i; j++)
            s*=j;
        s2+=s;
        s=1;
    }
    cout<<s2;
    return 0;
}

?????


by fanwenbing @ 2023-05-28 11:48:21

int128都过不了,更别提long int了,建议老老实实学习高精度


by Poombom @ 2023-06-01 15:46:37

@jfy2204 高精加上递归


by jfy2204 @ 2023-06-02 21:55:18

谁叫我是新手呢╮(╯▽╰)╭


|