mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 20:48:48 +00:00
parent
bfaa878ec3
commit
e8b22ef5df
58
S2OJ/1453/1453.cpp
Normal file
58
S2OJ/1453/1453.cpp
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
const int N = 1e5 + 5;
|
||||||
|
const int mod = 998244353;
|
||||||
|
|
||||||
|
int t, n, m, fac[N], inv[N], fac_inv[N];
|
||||||
|
|
||||||
|
inline int binpow(int a, int b) {
|
||||||
|
a %= mod;
|
||||||
|
|
||||||
|
int res = 1;
|
||||||
|
|
||||||
|
while (b) {
|
||||||
|
if (b & 1) res = static_cast<long long>(res) * a % mod;
|
||||||
|
a = static_cast<long long>(a) * a % mod;
|
||||||
|
b >>= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int C(int n, int m) {
|
||||||
|
return static_cast<long long>(fac[n]) * fac_inv[m] % mod * fac_inv[n - m] % mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::ios::sync_with_stdio(false);
|
||||||
|
cin.tie(nullptr);
|
||||||
|
|
||||||
|
fac[0] = 1;
|
||||||
|
for (int i = 1; i < N; i++) {
|
||||||
|
fac[i] = static_cast<long long>(fac[i - 1]) * i % mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
inv[0] = inv[1] = 1;
|
||||||
|
for (int i = 2; i < N; i++) {
|
||||||
|
inv[i] = static_cast<long long>(mod - mod / i) * inv[mod % i] % mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
fac_inv[0] = fac_inv[1] = 1;
|
||||||
|
for (int i = 2; i < N; i++) {
|
||||||
|
fac_inv[i] = static_cast<long long>(fac_inv[i - 1]) * inv[i] % mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
cin >> t;
|
||||||
|
|
||||||
|
while (t--) {
|
||||||
|
cin >> n >> m;
|
||||||
|
|
||||||
|
cout << static_cast<long long>(binpow(2, n - m)) * C(n, m) % mod << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
S2OJ/1453/data/data1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data10.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data3.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data4.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data5.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data6.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data7.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data8.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/data9.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/data9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1453/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1453/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user