有没有大神救救我

P1009 [NOIP1998 普及组] 阶乘之和

Man_Wilson @ 2024-12-21 08:24:12

做了半天只达到了两个测试点是什么鬼啊(求改)

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

by Gaochenxi103_QWQ @ 2024-12-21 08:27:56

需要写高精度


by Gaochenxi103_QWQ @ 2024-12-21 08:28:41

@Man_Wilson

long long


by Man_Wilson @ 2024-12-22 08:26:26

@Gaochenxi103_QWQ OK


by zyh0717 @ 2024-12-23 20:09:50

long long?


|