From 13525c4d0d20b2d067dc81fe9390ffa78c7604b4 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Fri, 25 Nov 2022 16:05:51 +0800 Subject: [PATCH] =?UTF-8?q?#10232.=20=E3=80=8C=E4=B8=80=E6=9C=AC=E9=80=9A?= =?UTF-8?q?=206.6=20=E7=BB=83=E4=B9=A0=203=E3=80=8D=E8=BD=A6=E7=9A=84?= =?UTF-8?q?=E6=94=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://loj.ac/s/1643806 --- LibreOJ/10232/10232.cpp | 49 ++++++++++++++++++++++++++++++++++++ LibreOJ/10232/data/1.in | 3 +++ LibreOJ/10232/data/1.out | 3 +++ LibreOJ/10232/data/10.in | 3 +++ LibreOJ/10232/data/10.out | 3 +++ LibreOJ/10232/data/2.in | 3 +++ LibreOJ/10232/data/2.out | 3 +++ LibreOJ/10232/data/3.in | 3 +++ LibreOJ/10232/data/3.out | 3 +++ LibreOJ/10232/data/4.in | 3 +++ LibreOJ/10232/data/4.out | 3 +++ LibreOJ/10232/data/5.in | 3 +++ LibreOJ/10232/data/5.out | 3 +++ LibreOJ/10232/data/6.in | 3 +++ LibreOJ/10232/data/6.out | 3 +++ LibreOJ/10232/data/7.in | 3 +++ LibreOJ/10232/data/7.out | 3 +++ LibreOJ/10232/data/8.in | 3 +++ LibreOJ/10232/data/8.out | 3 +++ LibreOJ/10232/data/9.in | 3 +++ LibreOJ/10232/data/9.out | 3 +++ LibreOJ/10232/data/place.cpp | 3 +++ 22 files changed, 112 insertions(+) create mode 100644 LibreOJ/10232/10232.cpp create mode 100644 LibreOJ/10232/data/1.in create mode 100644 LibreOJ/10232/data/1.out create mode 100644 LibreOJ/10232/data/10.in create mode 100644 LibreOJ/10232/data/10.out create mode 100644 LibreOJ/10232/data/2.in create mode 100644 LibreOJ/10232/data/2.out create mode 100644 LibreOJ/10232/data/3.in create mode 100644 LibreOJ/10232/data/3.out create mode 100644 LibreOJ/10232/data/4.in create mode 100644 LibreOJ/10232/data/4.out create mode 100644 LibreOJ/10232/data/5.in create mode 100644 LibreOJ/10232/data/5.out create mode 100644 LibreOJ/10232/data/6.in create mode 100644 LibreOJ/10232/data/6.out create mode 100644 LibreOJ/10232/data/7.in create mode 100644 LibreOJ/10232/data/7.out create mode 100644 LibreOJ/10232/data/8.in create mode 100644 LibreOJ/10232/data/8.out create mode 100644 LibreOJ/10232/data/9.in create mode 100644 LibreOJ/10232/data/9.out create mode 100644 LibreOJ/10232/data/place.cpp diff --git a/LibreOJ/10232/10232.cpp b/LibreOJ/10232/10232.cpp new file mode 100644 index 00000000..bd94dc16 --- /dev/null +++ b/LibreOJ/10232/10232.cpp @@ -0,0 +1,49 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 2005; +const int mod = 1e5 + 3; + +int a, b, c, d, k, fac[N], inv[N], fac_inv[N], ans; + +inline int C(int n, int m) { + return static_cast(fac[n]) * fac_inv[m] % mod * fac_inv[n - m] % mod; +} + +int f(int n, int m, int k) { + if (k > n || k > m) return 0; + return static_cast(C(n, k)) * C(m, k) % mod * fac[k] % 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 >> a >> b >> c >> d >> k; + + for (int i = 0; i <= k; i++) { + ans = (ans + static_cast(f(a, b, i)) * f(a + c - i, d, k - i)) % mod; + } + + cout << ans << endl; + + return 0; +} diff --git a/LibreOJ/10232/data/1.in b/LibreOJ/10232/data/1.in new file mode 100644 index 00000000..3aeec41a --- /dev/null +++ b/LibreOJ/10232/data/1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:124bcb6701fe152f2f40821f168d3d01cc23e73d9e0098627d889b764d3bf359 +size 11 diff --git a/LibreOJ/10232/data/1.out b/LibreOJ/10232/data/1.out new file mode 100644 index 00000000..33f80031 --- /dev/null +++ b/LibreOJ/10232/data/1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c468f5e59f2871b946e051445493bbcace531d597edbbcc9935e7d02d025114 +size 3 diff --git a/LibreOJ/10232/data/10.in b/LibreOJ/10232/data/10.in new file mode 100644 index 00000000..ac4db9c5 --- /dev/null +++ b/LibreOJ/10232/data/10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a2016f31c8a54c31a9c81d73aeeb1a90170eeeb9956b8dbd520db9f1a1abff3 +size 22 diff --git a/LibreOJ/10232/data/10.out b/LibreOJ/10232/data/10.out new file mode 100644 index 00000000..a46141f0 --- /dev/null +++ b/LibreOJ/10232/data/10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:586c152bb56fb1aaf00a860308dc48c9e4da0bafb773c7070e05f1760903384b +size 7 diff --git a/LibreOJ/10232/data/2.in b/LibreOJ/10232/data/2.in new file mode 100644 index 00000000..4de17b30 --- /dev/null +++ b/LibreOJ/10232/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1306699f64ac6404f65e67656def9ad21cdd599102886f75ea2a52b01e3834e4 +size 11 diff --git a/LibreOJ/10232/data/2.out b/LibreOJ/10232/data/2.out new file mode 100644 index 00000000..c14ed41d --- /dev/null +++ b/LibreOJ/10232/data/2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9cf064e79fb6c84f4a896468a7111f58ee73d99fced49aef5b6a67a9b6cc09e0 +size 6 diff --git a/LibreOJ/10232/data/3.in b/LibreOJ/10232/data/3.in new file mode 100644 index 00000000..e2dcf245 --- /dev/null +++ b/LibreOJ/10232/data/3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ce81bcaef22b84141f2e17cfe0743116044ed6dfe00d8f89d65bf7c82fd1d9c +size 19 diff --git a/LibreOJ/10232/data/3.out b/LibreOJ/10232/data/3.out new file mode 100644 index 00000000..913b9301 --- /dev/null +++ b/LibreOJ/10232/data/3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a87dbd37cef470859c19331e5a71e81f61cf5dbda3fe334fc0893fba27b4453 +size 6 diff --git a/LibreOJ/10232/data/4.in b/LibreOJ/10232/data/4.in new file mode 100644 index 00000000..f0f7c56f --- /dev/null +++ b/LibreOJ/10232/data/4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e7df507dcad06c30ad32a02569781fa9ec08063418a86125a15f6bef9ac1b39 +size 11 diff --git a/LibreOJ/10232/data/4.out b/LibreOJ/10232/data/4.out new file mode 100644 index 00000000..9ea9cdb8 --- /dev/null +++ b/LibreOJ/10232/data/4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2dce8836496f5a7fd5ffa8894dd121f18623c66021f59233317a812bc4040a73 +size 7 diff --git a/LibreOJ/10232/data/5.in b/LibreOJ/10232/data/5.in new file mode 100644 index 00000000..2490b728 --- /dev/null +++ b/LibreOJ/10232/data/5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f04d4d43c2d64499f8d955c10469b06850c33aadc6155b898513e598aac84774 +size 16 diff --git a/LibreOJ/10232/data/5.out b/LibreOJ/10232/data/5.out new file mode 100644 index 00000000..a6027f21 --- /dev/null +++ b/LibreOJ/10232/data/5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d4134ad7e94a95917799d4b5e01edab78e65abcccfd6604b58857e8b231f9bc +size 7 diff --git a/LibreOJ/10232/data/6.in b/LibreOJ/10232/data/6.in new file mode 100644 index 00000000..2e16ebe9 --- /dev/null +++ b/LibreOJ/10232/data/6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c530b5a44a1d102dab52c4ce879872d65ab337a4f4e8b3cb679f02d5213eb79 +size 21 diff --git a/LibreOJ/10232/data/6.out b/LibreOJ/10232/data/6.out new file mode 100644 index 00000000..80b9e878 --- /dev/null +++ b/LibreOJ/10232/data/6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3749d73cf6434671b25cd200f6599b25308b3486325c33768edc84897be16de3 +size 7 diff --git a/LibreOJ/10232/data/7.in b/LibreOJ/10232/data/7.in new file mode 100644 index 00000000..36024ebe --- /dev/null +++ b/LibreOJ/10232/data/7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52f39df8e212f88ef669e17de918e713f9515fddc60906c6c2371ce88c41bcd3 +size 26 diff --git a/LibreOJ/10232/data/7.out b/LibreOJ/10232/data/7.out new file mode 100644 index 00000000..511dc354 --- /dev/null +++ b/LibreOJ/10232/data/7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:099221e092b99df8debf2bda60d8feeb21ae4036c62a107250ed30a6520f9bdb +size 7 diff --git a/LibreOJ/10232/data/8.in b/LibreOJ/10232/data/8.in new file mode 100644 index 00000000..fb63f6b8 --- /dev/null +++ b/LibreOJ/10232/data/8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6311b6cd473784ef4da9078b6cd79531665c1bf2d746749b03a18d27ecb8ba2 +size 22 diff --git a/LibreOJ/10232/data/8.out b/LibreOJ/10232/data/8.out new file mode 100644 index 00000000..8a4fbe70 --- /dev/null +++ b/LibreOJ/10232/data/8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:67f1f6508ecaa8f85c8aaabfb4d09d10761a15101d8db184b2abbddd6dbbb742 +size 7 diff --git a/LibreOJ/10232/data/9.in b/LibreOJ/10232/data/9.in new file mode 100644 index 00000000..a1309a40 --- /dev/null +++ b/LibreOJ/10232/data/9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1941e469aba1443dc3c75bd2d6c0fa9c8e601f237d4700e870afb27d44abca14 +size 20 diff --git a/LibreOJ/10232/data/9.out b/LibreOJ/10232/data/9.out new file mode 100644 index 00000000..bac68202 --- /dev/null +++ b/LibreOJ/10232/data/9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3709ed9e6d2c34648b0ab1cfc8476d327ae82defeed8009f14ab45b1246438c9 +size 7 diff --git a/LibreOJ/10232/data/place.cpp b/LibreOJ/10232/data/place.cpp new file mode 100644 index 00000000..9fff7360 --- /dev/null +++ b/LibreOJ/10232/data/place.cpp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a33e1270f2b363680d89e7598bb4ee7018cbecb2e382552b69602cacea3e3777 +size 1183