From e8b22ef5df14baef01aa3e59e832b44d643faf3f Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Fri, 22 Jul 2022 14:47:05 +0800 Subject: [PATCH] =?UTF-8?q?#1453.=20=E3=80=90NOIP=E6=A8=A1=E6=8B=9F?= =?UTF-8?q?=EF=BC=88=E7=AC=AC=E4=BA=8C=E5=A5=97=EF=BC=89=E3=80=91A.=20?= =?UTF-8?q?=E6=95=B0=E6=AD=A3=E6=96=B9=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sjzezoj.com/submission/53772 --- S2OJ/1453/1453.cpp | 58 +++++++++++++++++++++++++++++++++++++ S2OJ/1453/data/data1.in | 3 ++ S2OJ/1453/data/data1.out | 3 ++ S2OJ/1453/data/data10.in | 3 ++ S2OJ/1453/data/data10.out | 3 ++ S2OJ/1453/data/data2.in | 3 ++ S2OJ/1453/data/data2.out | 3 ++ S2OJ/1453/data/data3.in | 3 ++ S2OJ/1453/data/data3.out | 3 ++ S2OJ/1453/data/data4.in | 3 ++ S2OJ/1453/data/data4.out | 3 ++ S2OJ/1453/data/data5.in | 3 ++ S2OJ/1453/data/data5.out | 3 ++ S2OJ/1453/data/data6.in | 3 ++ S2OJ/1453/data/data6.out | 3 ++ S2OJ/1453/data/data7.in | 3 ++ S2OJ/1453/data/data7.out | 3 ++ S2OJ/1453/data/data8.in | 3 ++ S2OJ/1453/data/data8.out | 3 ++ S2OJ/1453/data/data9.in | 3 ++ S2OJ/1453/data/data9.out | 3 ++ S2OJ/1453/data/problem.conf | 3 ++ 22 files changed, 121 insertions(+) create mode 100644 S2OJ/1453/1453.cpp create mode 100644 S2OJ/1453/data/data1.in create mode 100644 S2OJ/1453/data/data1.out create mode 100644 S2OJ/1453/data/data10.in create mode 100644 S2OJ/1453/data/data10.out create mode 100644 S2OJ/1453/data/data2.in create mode 100644 S2OJ/1453/data/data2.out create mode 100644 S2OJ/1453/data/data3.in create mode 100644 S2OJ/1453/data/data3.out create mode 100644 S2OJ/1453/data/data4.in create mode 100644 S2OJ/1453/data/data4.out create mode 100644 S2OJ/1453/data/data5.in create mode 100644 S2OJ/1453/data/data5.out create mode 100644 S2OJ/1453/data/data6.in create mode 100644 S2OJ/1453/data/data6.out create mode 100644 S2OJ/1453/data/data7.in create mode 100644 S2OJ/1453/data/data7.out create mode 100644 S2OJ/1453/data/data8.in create mode 100644 S2OJ/1453/data/data8.out create mode 100644 S2OJ/1453/data/data9.in create mode 100644 S2OJ/1453/data/data9.out create mode 100644 S2OJ/1453/data/problem.conf diff --git a/S2OJ/1453/1453.cpp b/S2OJ/1453/1453.cpp new file mode 100644 index 00000000..b66bf76f --- /dev/null +++ b/S2OJ/1453/1453.cpp @@ -0,0 +1,58 @@ +#include + +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(res) * a % mod; + a = static_cast(a) * a % mod; + b >>= 1; + } + + return res; +} + +inline int C(int n, int m) { + return static_cast(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(fac[i - 1]) * i % mod; + } + + inv[0] = inv[1] = 1; + for (int i = 2; i < N; i++) { + inv[i] = static_cast(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(fac_inv[i - 1]) * inv[i] % mod; + } + + cin >> t; + + while (t--) { + cin >> n >> m; + + cout << static_cast(binpow(2, n - m)) * C(n, m) % mod << endl; + } + + return 0; +} diff --git a/S2OJ/1453/data/data1.in b/S2OJ/1453/data/data1.in new file mode 100644 index 00000000..ccd2bfb8 --- /dev/null +++ b/S2OJ/1453/data/data1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:637120e3536830555686b7611333e96951395f00b162d420575b57f8dc39415a +size 1177918 diff --git a/S2OJ/1453/data/data1.out b/S2OJ/1453/data/data1.out new file mode 100644 index 00000000..6817f097 --- /dev/null +++ b/S2OJ/1453/data/data1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc613151d434b947d91c899c804ffb14fd3d1bea9d39dc9b14df45f52bb21e4a +size 644425 diff --git a/S2OJ/1453/data/data10.in b/S2OJ/1453/data/data10.in new file mode 100644 index 00000000..2dbe8c49 --- /dev/null +++ b/S2OJ/1453/data/data10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e540223599f4bc8246208445f8249c3c0650b8249a1343f1f1981cb43a309ba6 +size 1181715 diff --git a/S2OJ/1453/data/data10.out b/S2OJ/1453/data/data10.out new file mode 100644 index 00000000..6a16c9b5 --- /dev/null +++ b/S2OJ/1453/data/data10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d56cfd428baaf5b2f788fcaab74b233d011cae35a6d734a5ad382ff5ac37e74a +size 988874 diff --git a/S2OJ/1453/data/data2.in b/S2OJ/1453/data/data2.in new file mode 100644 index 00000000..b2219228 --- /dev/null +++ b/S2OJ/1453/data/data2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:511a95372d8ca23f4ec4f412bfe197cb3a7af4b3064ebb6a6c66b5597c61a041 +size 1181862 diff --git a/S2OJ/1453/data/data2.out b/S2OJ/1453/data/data2.out new file mode 100644 index 00000000..0c681d2e --- /dev/null +++ b/S2OJ/1453/data/data2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c775bd1aac497b96e02c9eb5ea08afb2a815be0401ecf72b0b5b2994087dd7f +size 988798 diff --git a/S2OJ/1453/data/data3.in b/S2OJ/1453/data/data3.in new file mode 100644 index 00000000..cce8416d --- /dev/null +++ b/S2OJ/1453/data/data3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:508337c52c79630f2065d4ad5e995829cfbb3983729330d0db826feea52733cc +size 789020 diff --git a/S2OJ/1453/data/data3.out b/S2OJ/1453/data/data3.out new file mode 100644 index 00000000..0fa99ff7 --- /dev/null +++ b/S2OJ/1453/data/data3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53857fab8e17cc49eacc709dcb2f3338d808926d6ecd446f0570419ec6fcfd72 +size 988685 diff --git a/S2OJ/1453/data/data4.in b/S2OJ/1453/data/data4.in new file mode 100644 index 00000000..5d9746ea --- /dev/null +++ b/S2OJ/1453/data/data4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c6fea0cb3d4e8327556a2d36b9edff7c4eda0a59b86fccbbe13b002bb3352ecb +size 788838 diff --git a/S2OJ/1453/data/data4.out b/S2OJ/1453/data/data4.out new file mode 100644 index 00000000..ebf733f7 --- /dev/null +++ b/S2OJ/1453/data/data4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6716e7962c7638b55a1462e8a4d04f392dae822735705374acda3aaf88dadd15 +size 988900 diff --git a/S2OJ/1453/data/data5.in b/S2OJ/1453/data/data5.in new file mode 100644 index 00000000..7a8fc6b9 --- /dev/null +++ b/S2OJ/1453/data/data5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44c886816063a97f8ee6f5e27a552a3dd884dd5534801bab6be5f2521ac32dd6 +size 1178210 diff --git a/S2OJ/1453/data/data5.out b/S2OJ/1453/data/data5.out new file mode 100644 index 00000000..0441c445 --- /dev/null +++ b/S2OJ/1453/data/data5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22486206bfa4f250d091f281ee5ec4d61408f80313129b8975e2895a153d5afa +size 980799 diff --git a/S2OJ/1453/data/data6.in b/S2OJ/1453/data/data6.in new file mode 100644 index 00000000..77d6cc76 --- /dev/null +++ b/S2OJ/1453/data/data6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68400798d518a4e0eff5c93ae5b6a2b19eb13524342b757a5bc24c27bfaaf493 +size 1181695 diff --git a/S2OJ/1453/data/data6.out b/S2OJ/1453/data/data6.out new file mode 100644 index 00000000..d31dd407 --- /dev/null +++ b/S2OJ/1453/data/data6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18c229aa843c5e4114d983f283500ce75711cc113b716f8d604c3db4cc387c84 +size 988952 diff --git a/S2OJ/1453/data/data7.in b/S2OJ/1453/data/data7.in new file mode 100644 index 00000000..185880b1 --- /dev/null +++ b/S2OJ/1453/data/data7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e2e239b21dfc2f7c85e59ccfb34129dfc92b4e12f6a1caf7d61fb7b2c218f16 +size 1181691 diff --git a/S2OJ/1453/data/data7.out b/S2OJ/1453/data/data7.out new file mode 100644 index 00000000..cc23f6da --- /dev/null +++ b/S2OJ/1453/data/data7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd5818b5c3cd77a70a4ea85cbee59d80de1e4113ca3cd36aa3ac8aee0e325f8f +size 988819 diff --git a/S2OJ/1453/data/data8.in b/S2OJ/1453/data/data8.in new file mode 100644 index 00000000..c9e79728 --- /dev/null +++ b/S2OJ/1453/data/data8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c67f47924277e4c585e55faeb1df41ff5a30854f287936097c9085113b972255 +size 1181596 diff --git a/S2OJ/1453/data/data8.out b/S2OJ/1453/data/data8.out new file mode 100644 index 00000000..4403cb67 --- /dev/null +++ b/S2OJ/1453/data/data8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:49897e7d30b1576fa2bebb007ea7277210bcbe7d9d14950602ddd7268b14628f +size 989068 diff --git a/S2OJ/1453/data/data9.in b/S2OJ/1453/data/data9.in new file mode 100644 index 00000000..c6e7e6c2 --- /dev/null +++ b/S2OJ/1453/data/data9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36cc67c0b7df2abab93be7fb772ca4b068e7a30ea431413191b902353eac5c9c +size 1181797 diff --git a/S2OJ/1453/data/data9.out b/S2OJ/1453/data/data9.out new file mode 100644 index 00000000..b3e89f92 --- /dev/null +++ b/S2OJ/1453/data/data9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:28303d39ff7c3880535b9350d5d1b859bd313cf40c54adb1f1c6dfb2b4e510ec +size 988891 diff --git a/S2OJ/1453/data/problem.conf b/S2OJ/1453/data/problem.conf new file mode 100644 index 00000000..ba9de959 --- /dev/null +++ b/S2OJ/1453/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30571b8545311d892f94d95e21b7a5ee74e6f33bf2ec8f532fd209827fdd4be9 +size 194