50

P1009 [NOIP1998 普及组] 阶乘之和

songcaihan @ 2024-12-08 14:23:24

#include <iostream>
using namespace std;
int main (){
    long long n,s=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        long long k=1;
        for (int j=1;j<=i;j++){
            k*=j;
        }
           s+=k; 
    }
    cout <<s<<endl;
    return 0;
}

by _wsLan_ @ 2024-12-08 14:26:07

高精度啊,longlong存不下


by LionBlaze @ 2024-12-08 14:26:57

@songcaihan 你说得对,但是【模板】高精乘法


|