mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-10 02:58:48 +00:00
「MCOI-09」MCOI Round 9
T182489: R52546756
This commit is contained in:
parent
6899c72512
commit
3ebdb99d95
29
Luogu/contest/45812/T182489/T182489.cpp
Normal file
29
Luogu/contest/45812/T182489/T182489.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
const int mod = 998244353;
|
||||
|
||||
int main() {
|
||||
int n, k;
|
||||
cin >> n >> k;
|
||||
int v = 1, q = 1;
|
||||
for (int i = 0; i < n - k; i++) {
|
||||
v = 2ll * v % mod;
|
||||
}
|
||||
for (int i = n - k + 1; i <= n; i++) {
|
||||
v = 1ll * i * v % mod;
|
||||
}
|
||||
for (int i = 1; i <= k; i++) {
|
||||
q = 1ll * i * q % mod;
|
||||
}
|
||||
int a = 1, e = mod - 2;
|
||||
while (e) {
|
||||
if (e & 1) {
|
||||
a = 1ll * a * q % mod;
|
||||
}
|
||||
q = 1ll * q * q % mod;
|
||||
e >>= 1;
|
||||
}
|
||||
cout << 1ll * v * a % mod << endl;
|
||||
}
|
Loading…
Reference in New Issue
Block a user