个人不会用高精度写此题,谁能帮我讲下谢谢。

P1009 [NOIP1998 普及组] 阶乘之和

Better_Tomorrow @ 2024-05-18 22:24:20

#include<bits/stdc++.h>

using namespace std;
int jiecheng(int n) {
    if (n == 1) {
        return n;
    }
    return n * jiecheng(n - 1);
}

int main() {
    int n, sum = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        sum += jiecheng(i);
    }
    cout << sum;
    return 0;
}

by Special_Tony @ 2024-05-18 22:25:17

@JustNow 题解


by Muse_Dash @ 2024-05-18 22:28:09

python


by Ice_rnfmabj @ 2024-05-18 23:01:16

@JustNow 题解,或者先学高精度


by liboya5074 @ 2024-05-19 14:26:38

Python 秒了


|