From 0bb91dfd42fffca7170c62bdf9cdb7e8c5e2cbd3 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 6 Feb 2023 20:57:51 +0800 Subject: [PATCH] =?UTF-8?q?#1896.=20=E3=80=90JSOI2011=E3=80=91=E5=88=86?= =?UTF-8?q?=E7=89=B9=E4=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sjzezoj.com/submission/68109 --- S2OJ/1896/1896.cpp | 54 +++++++++++++++++++++++++++++++++++++ S2OJ/1896/data/data1.in | 3 +++ S2OJ/1896/data/data1.out | 3 +++ S2OJ/1896/data/data10.in | 3 +++ S2OJ/1896/data/data10.out | 3 +++ S2OJ/1896/data/data2.in | 3 +++ S2OJ/1896/data/data2.out | 3 +++ S2OJ/1896/data/data3.in | 3 +++ S2OJ/1896/data/data3.out | 3 +++ S2OJ/1896/data/data4.in | 3 +++ S2OJ/1896/data/data4.out | 3 +++ S2OJ/1896/data/data5.in | 3 +++ S2OJ/1896/data/data5.out | 3 +++ S2OJ/1896/data/data6.in | 3 +++ S2OJ/1896/data/data6.out | 3 +++ S2OJ/1896/data/data7.in | 3 +++ S2OJ/1896/data/data7.out | 3 +++ S2OJ/1896/data/data8.in | 3 +++ S2OJ/1896/data/data8.out | 3 +++ S2OJ/1896/data/data9.in | 3 +++ S2OJ/1896/data/data9.out | 3 +++ S2OJ/1896/data/problem.conf | 3 +++ 22 files changed, 117 insertions(+) create mode 100644 S2OJ/1896/1896.cpp create mode 100644 S2OJ/1896/data/data1.in create mode 100644 S2OJ/1896/data/data1.out create mode 100644 S2OJ/1896/data/data10.in create mode 100644 S2OJ/1896/data/data10.out create mode 100644 S2OJ/1896/data/data2.in create mode 100644 S2OJ/1896/data/data2.out create mode 100644 S2OJ/1896/data/data3.in create mode 100644 S2OJ/1896/data/data3.out create mode 100644 S2OJ/1896/data/data4.in create mode 100644 S2OJ/1896/data/data4.out create mode 100644 S2OJ/1896/data/data5.in create mode 100644 S2OJ/1896/data/data5.out create mode 100644 S2OJ/1896/data/data6.in create mode 100644 S2OJ/1896/data/data6.out create mode 100644 S2OJ/1896/data/data7.in create mode 100644 S2OJ/1896/data/data7.out create mode 100644 S2OJ/1896/data/data8.in create mode 100644 S2OJ/1896/data/data8.out create mode 100644 S2OJ/1896/data/data9.in create mode 100644 S2OJ/1896/data/data9.out create mode 100644 S2OJ/1896/data/problem.conf diff --git a/S2OJ/1896/1896.cpp b/S2OJ/1896/1896.cpp new file mode 100644 index 00000000..38cbae5e --- /dev/null +++ b/S2OJ/1896/1896.cpp @@ -0,0 +1,54 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 2005; +const int mod = 1e9 + 7; + +int n, m, a[N], c[N][N], f[N], ans; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + c[0][0] = 1; + + for (int i = 1; i < N; ++i) { + c[i][0] = 1; + + for (int j = 1; j <= i; ++j) { + c[i][j] = (static_cast(c[i - 1][j - 1]) + c[i - 1][j]) % mod; + } + } + + cin >> n >> m; + + for (int i = 1; i <= m; i++) { + cin >> a[i]; + } + + for (int i = 0; i < n; i++) { + f[i] = 1; + + for (int j = 1; j <= m; j++) { + f[i] = static_cast(f[i]) * c[n - i + a[j] - 1][n - i - 1] % mod; + } + + f[i] = static_cast(f[i]) * c[n][i] % mod; + } + + for (int i = 0; i < n; i++) { + if (i % 2 == 0) { + ans = (static_cast(ans) + f[i]) % mod; + } else { + ans = (static_cast(ans) - f[i] + mod) % mod; + } + } + + cout << ans << endl; + + return 0; +} + diff --git a/S2OJ/1896/data/data1.in b/S2OJ/1896/data/data1.in new file mode 100644 index 00000000..ae6a3dd7 --- /dev/null +++ b/S2OJ/1896/data/data1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:521626a96a0206fb32d65117983f0bfec42b92bd82a3728fae30150cf717cc39 +size 771 diff --git a/S2OJ/1896/data/data1.out b/S2OJ/1896/data/data1.out new file mode 100644 index 00000000..21b20138 --- /dev/null +++ b/S2OJ/1896/data/data1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a661499cb8e27555d9a77f610416f405e3c4cfc0c4e492b95bc41631fdfc32eb +size 10 diff --git a/S2OJ/1896/data/data10.in b/S2OJ/1896/data/data10.in new file mode 100644 index 00000000..df53c1ff --- /dev/null +++ b/S2OJ/1896/data/data10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8612a862983a44b90f1f05b9760b59028f5c52bb38e5d9434777c94cebdb0446 +size 3877 diff --git a/S2OJ/1896/data/data10.out b/S2OJ/1896/data/data10.out new file mode 100644 index 00000000..ab191d2c --- /dev/null +++ b/S2OJ/1896/data/data10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2add00c70113326afe3e36e83b973cd3c52cf319006498e2e0ebd66ddd09f1f9 +size 10 diff --git a/S2OJ/1896/data/data2.in b/S2OJ/1896/data/data2.in new file mode 100644 index 00000000..12c141e1 --- /dev/null +++ b/S2OJ/1896/data/data2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8bc081fd86f3dc231c4316c2ddaf4f89bf28229bd16f09522024e67000c8e14c +size 45 diff --git a/S2OJ/1896/data/data2.out b/S2OJ/1896/data/data2.out new file mode 100644 index 00000000..33658889 --- /dev/null +++ b/S2OJ/1896/data/data2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c7697610d471d72bd2516809754297b488b4db088dfedef02491a0d2f3b1975 +size 10 diff --git a/S2OJ/1896/data/data3.in b/S2OJ/1896/data/data3.in new file mode 100644 index 00000000..0ddb95ea --- /dev/null +++ b/S2OJ/1896/data/data3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c27052ff323bee81a51083494ee78ef487f8f54e9ade7a5f8ceee074f852fd44 +size 425 diff --git a/S2OJ/1896/data/data3.out b/S2OJ/1896/data/data3.out new file mode 100644 index 00000000..085557c2 --- /dev/null +++ b/S2OJ/1896/data/data3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ac30ead7998d2a1beb4dbfba82b3e5c5b5f17e840a375e2394c793a69170915 +size 10 diff --git a/S2OJ/1896/data/data4.in b/S2OJ/1896/data/data4.in new file mode 100644 index 00000000..1d603dfc --- /dev/null +++ b/S2OJ/1896/data/data4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6a2554455f6beae2b409f5aa1f984e690984b40821d2d6d25098d0c64a9b7bd +size 24 diff --git a/S2OJ/1896/data/data4.out b/S2OJ/1896/data/data4.out new file mode 100644 index 00000000..7e740be1 --- /dev/null +++ b/S2OJ/1896/data/data4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3540d8e7a800e033b9f951a86d4d38d170ec7fe84e0777684010fc143a201125 +size 10 diff --git a/S2OJ/1896/data/data5.in b/S2OJ/1896/data/data5.in new file mode 100644 index 00000000..56b15a1f --- /dev/null +++ b/S2OJ/1896/data/data5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82c206fbd738342008ae4aa258072f60b1707f1e8e33c73b57f860374ee2a1ee +size 115 diff --git a/S2OJ/1896/data/data5.out b/S2OJ/1896/data/data5.out new file mode 100644 index 00000000..1a76acfd --- /dev/null +++ b/S2OJ/1896/data/data5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c28b8bbafc01cc66bc10ad945f49fb2721969ccd5aaf76573ecf0126ccef115 +size 10 diff --git a/S2OJ/1896/data/data6.in b/S2OJ/1896/data/data6.in new file mode 100644 index 00000000..9bb1c784 --- /dev/null +++ b/S2OJ/1896/data/data6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2153286dd5bdff329f397358855ca9bbf2431ab7459becfd5f0c987881a20a8b +size 17 diff --git a/S2OJ/1896/data/data6.out b/S2OJ/1896/data/data6.out new file mode 100644 index 00000000..b1c0a225 --- /dev/null +++ b/S2OJ/1896/data/data6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f75414c8a0aeda4ac3590d24805340b6eb909dead7c7a2402ba94f99425bd53b +size 10 diff --git a/S2OJ/1896/data/data7.in b/S2OJ/1896/data/data7.in new file mode 100644 index 00000000..4db2f305 --- /dev/null +++ b/S2OJ/1896/data/data7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:975c06a3d79a244b2f46a7721e843be2b3f726ed2209ff7d82ae35d94dd08f6f +size 16 diff --git a/S2OJ/1896/data/data7.out b/S2OJ/1896/data/data7.out new file mode 100644 index 00000000..74be6090 --- /dev/null +++ b/S2OJ/1896/data/data7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:272321ca27d3cd6b6063d9664a4c7d5539443dcc043790ebcf56ed5ab8c3b660 +size 10 diff --git a/S2OJ/1896/data/data8.in b/S2OJ/1896/data/data8.in new file mode 100644 index 00000000..50e9c16b --- /dev/null +++ b/S2OJ/1896/data/data8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bfbe90b10a76540d39a1bdd2743d1d766b2c44ef1b0eac8c85422de4b4539a65 +size 34 diff --git a/S2OJ/1896/data/data8.out b/S2OJ/1896/data/data8.out new file mode 100644 index 00000000..213bfc03 --- /dev/null +++ b/S2OJ/1896/data/data8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63571a98a850d3655a6f57ea420e21f7a366072e808a7e04ecc4fe4cd057528c +size 10 diff --git a/S2OJ/1896/data/data9.in b/S2OJ/1896/data/data9.in new file mode 100644 index 00000000..0b972b09 --- /dev/null +++ b/S2OJ/1896/data/data9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ae4dd9b7a2a173e329d4c0c99d32ea1fbbccae830cc9b8d559e77e09e7cb903 +size 29 diff --git a/S2OJ/1896/data/data9.out b/S2OJ/1896/data/data9.out new file mode 100644 index 00000000..f58dae41 --- /dev/null +++ b/S2OJ/1896/data/data9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66dadd6dd8838dbcd8f8a530c9dd5d68e5ab3b7172e57e60d2cc80c29c619357 +size 10 diff --git a/S2OJ/1896/data/problem.conf b/S2OJ/1896/data/problem.conf new file mode 100644 index 00000000..6fd10e34 --- /dev/null +++ b/S2OJ/1896/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb8bf60cdf306f5a69f06add77febc199735a178f6d6a85d4add1509d4db5f49 +size 208