求调 , xuan关
查看原帖
求调 , xuan关
1672765
forty_sixty楼主2025/7/23 16:25
#include <bits/stdc++.h>
using namespace std ;
int n , a[100] , b[100] ;
void xqw( int x ){
    int g = 0 ;
    for ( int i = 100 ; i >= 0 ; i--){
        a[i] = a[i] * x + g ;
        a[i] %= 10 ;
        g += a[i] / 10 ;
    }
}
void cyy(){
    int g = 0 ;
    for( int i = 100 ; i >= 0 ; i --){
        b[i] = b[i] + a[i] + g ;
        b[i] %= 10 ;
        g += b[i] / 10 ;
    }
}
int main(){
    cin >> n ;
    memset(a , 0 , sizeof(a));
    memset(b , 0 , sizeof(b));
    a[99] = b[99] = 1 ;
    for( int i = 2 ; i <= n  ; i ++ ){
        xqw(i);
        cyy();
    }
    int c = 0 ;
    while( c < 100 && b[c] == 0)
        c++;
    for ( int i = c ; i < 100 ; i ++)
        cout << b[i];
    return 0 ;
}
2025/7/23 16:25
加载中...