求助大佬!50分!

P1009 [NOIP1998 普及组] 阶乘之和

jcjkyx110507 @ 2023-11-24 20:56:43

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

by NO_OI_NO_LIFE @ 2023-11-24 21:12:57

@jinzhilong 你想学的高精度在这


by xiaoshumiao @ 2023-11-24 21:16:44

@jinzhilong 顺便说一句,这题高精乘可以用高精乘低精,别想复杂了。


by jcjkyx110507 @ 2023-11-24 21:29:12

@zyh0516_lucky @xiaoshumiao Thank you for your help!


by zhangshengzhe1 @ 2023-12-09 11:35:17

@jinzhilong 用高精度


上一页 |