2 solutions

  • 0
    @ 2026-7-28 17:42:03
    #include <bits/stdc++.h>
    using namespace std;
    int main(){
        int n;
        cin >> n;
        int c1[50001] = {0};
        int lc = 1;
        c1[0] = 1;
        for(int i = 2; i <= n; i++){
            int x = 0;
            for(int j = 0; j < lc; j++){
                int sum = c1[j] * i + x;
                c1[j] = sum % 10;
                x = sum / 10;
            }
            while(x > 0){
                c1[lc] = x % 10;
                x /= 10;
                lc++;
            }
        }
        for(int i = lc - 1; i >= 0; i--){
            cout << c1[i];
        }
        return 0;
    }
    

    Information

    ID
    1805
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    6
    Tags
    # Submissions
    21
    Accepted
    11
    Uploaded By