85 分求调
查看原帖
85 分求调
711887
lihl楼主2024/9/8 15:56
#include<bits/stdc++.h>
using namespace std;
#define fileIO(s) do {freopen(s".in", "r", stdin); freopen(s".out", "w", stdout);} while(false)
#define debug(format...) fprintf(stderr, format)
#define ll long long
#define lll __int128
const ll Mod = 998244353;
inline ll ksm(ll a, ll b) {
	ll z = 1;
	while (b) {
		if (b & 1) z = Mod ? (lll) z * a % Mod : z * a;
		a = Mod ? (lll) a * a % Mod : a * a;
		b >>= 1;
	}
	return z;
}
int main() {
	ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
	ll n;
	cin >> n;
	ll res = 1;
	for(ll i=1; i<=n; i++) {
		res = res * ksm(i,(n-i+2)*(n-i+1)/2*i) % Mod;
	}
	cout << res;


	return 0;
}

TLE,官方题解有误吧()

2024/9/8 15:56
加载中...