B,“展开全文”即可正常查看
图片说明

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>  pll;
#define fi first
#define se second
#define pk push_back
#define mk make_pair

const ll N=2e5+10, inf=0x3f3f3f3f3f3f3f3f;

ll ijk[N], ans[N], jk[N], kps[N], n;
ll mod=199999;
void init(){

    for(ll k=1;k<=mod;k++) kps[k]=(kps[k-1]+k)%mod;
    ans[0]=1;
    for(ll n=1;n<=mod;n++){
        ll i=n;
        jk[i]=jk[i-1];
        ll j=i;
        jk[i]=(jk[i]+j*kps[i]%mod)%mod;
        ans[n]=ans[n-1]*i%mod*jk[i]%mod;
    }

    return ;
}
void work(){
    scanf("%lld",&n);
    if(n>=mod) puts("0");
    else printf("%lld\n",ans[n]);
}
int main() {

    init();
    ll t;
    for(cin>>t;t--;)
        work();
    return 0;
}

点个赞吧,谢谢对本题解的支持,进入博客即可查看系列