diff --git a/LibreOJ/2173/2173.cpp b/LibreOJ/2173/2173.cpp new file mode 100644 index 00000000..7d3e93c0 --- /dev/null +++ b/LibreOJ/2173/2173.cpp @@ -0,0 +1,52 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 5e4 + 5, + M = 205; +const int mod = 1e9 + 7; + +int s[N][M], c[M][M]; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + s[0][0] = s[1][1] = 1; + + for (int i = 2; i < N; i++) { + s[i][1] = static_cast(s[i - 1][1]) * (i - 1) % mod; + } + + for (int i = 2; i < N; i++) { + for (int j = 1; j < M && j <= i; j++) { + s[i][j] = (static_cast(s[i - 1][j - 1]) + static_cast(s[i - 1][j]) * (i - 1)) % mod; + } + } + + for (int i = 0; i < M; i++) { + c[i][0] = c[i][i] = 1; + } + + for (int i = 2; i < M; i++) { + for (int j = 1; j < i; j++) { + c[i][j] = (static_cast(c[i - 1][j]) + c[i - 1][j - 1]) % mod; + } + } + + int t; + + cin >> t; + + while (t--) { + int n, a, b; + + cin >> n >> a >> b; + + cout << static_cast(s[n - 1][a + b - 2]) * c[a + b - 2][a - 1] % mod << endl; + } + + return 0; +} diff --git a/LibreOJ/2173/data/building1.in b/LibreOJ/2173/data/building1.in new file mode 100644 index 00000000..4adf3722 --- /dev/null +++ b/LibreOJ/2173/data/building1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ecbaeb9d3cf84306fde24c77947c61d00a3d45a2c678844eac9cffff0f52143 +size 39 diff --git a/LibreOJ/2173/data/building1.out b/LibreOJ/2173/data/building1.out new file mode 100644 index 00000000..f771cc7f --- /dev/null +++ b/LibreOJ/2173/data/building1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8668b1e8fc83be82e127f37d6faa8748aa367eca9b77f588353ce20646594ac1 +size 20 diff --git a/LibreOJ/2173/data/building10.in b/LibreOJ/2173/data/building10.in new file mode 100644 index 00000000..3406630f --- /dev/null +++ b/LibreOJ/2173/data/building10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bdb84fe7796e1779cf79ea30b3f2106b61142323478ba4c1d896730dc610c088 +size 2567929 diff --git a/LibreOJ/2173/data/building10.out b/LibreOJ/2173/data/building10.out new file mode 100644 index 00000000..7e4677bd --- /dev/null +++ b/LibreOJ/2173/data/building10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45976308f71d5020b26be4ea84ca695762399ad35da29edb4a537198010dce13 +size 2177245 diff --git a/LibreOJ/2173/data/building2.in b/LibreOJ/2173/data/building2.in new file mode 100644 index 00000000..46699d9d --- /dev/null +++ b/LibreOJ/2173/data/building2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa3f2fd952e4aea10f9647e92f867744d05bc6b797c9f6217f27d427a4f92c53 +size 51 diff --git a/LibreOJ/2173/data/building2.out b/LibreOJ/2173/data/building2.out new file mode 100644 index 00000000..e6c18a6a --- /dev/null +++ b/LibreOJ/2173/data/building2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60bfa7749fd73b1de05f8d37003eb16f9fb656db22fe5955bbecfbe65ad2a767 +size 55 diff --git a/LibreOJ/2173/data/building3.in b/LibreOJ/2173/data/building3.in new file mode 100644 index 00000000..996d2a63 --- /dev/null +++ b/LibreOJ/2173/data/building3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df185d1534a7759b0d3c4ff5a9ffe8995533dcee154fa0d4e375a2ac58bf065c +size 68 diff --git a/LibreOJ/2173/data/building3.out b/LibreOJ/2173/data/building3.out new file mode 100644 index 00000000..a5aa7992 --- /dev/null +++ b/LibreOJ/2173/data/building3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac26967407d8a52286b23b648a98c52001f708b5e40d4db349ca4cbeeb40c774 +size 55 diff --git a/LibreOJ/2173/data/building4.in b/LibreOJ/2173/data/building4.in new file mode 100644 index 00000000..8e615d2c --- /dev/null +++ b/LibreOJ/2173/data/building4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:72a97f352763737f5d02635c27dd64f6483e242d7873bb908743257699ada42e +size 68 diff --git a/LibreOJ/2173/data/building4.out b/LibreOJ/2173/data/building4.out new file mode 100644 index 00000000..4f2e1be2 --- /dev/null +++ b/LibreOJ/2173/data/building4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c996054966337d33cc46f645bc805f6642c70d490b0f0f385931ba8dd4a9ee3e +size 54 diff --git a/LibreOJ/2173/data/building5.in b/LibreOJ/2173/data/building5.in new file mode 100644 index 00000000..bd3058a3 --- /dev/null +++ b/LibreOJ/2173/data/building5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63f31aa4c5e7e5d43c6dbbf4750dac11ad01467a93b952fcc95fe195c2ae4c37 +size 2568041 diff --git a/LibreOJ/2173/data/building5.out b/LibreOJ/2173/data/building5.out new file mode 100644 index 00000000..5b4ab050 --- /dev/null +++ b/LibreOJ/2173/data/building5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c2f30216fb81df99bbbee3708afae877ac4e1353bdb5aa9f57f1750eb568be4 +size 2177792 diff --git a/LibreOJ/2173/data/building6.in b/LibreOJ/2173/data/building6.in new file mode 100644 index 00000000..67a34359 --- /dev/null +++ b/LibreOJ/2173/data/building6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fccfedac67bbdee4ab1ceaa3423000d8da80ca63fa1fd4b8ae4a9aa6e98b951e +size 2567763 diff --git a/LibreOJ/2173/data/building6.out b/LibreOJ/2173/data/building6.out new file mode 100644 index 00000000..1821d5fb --- /dev/null +++ b/LibreOJ/2173/data/building6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e16341de3665ddac01b46a918fccd207a3d10c9a37995fab6400ec5ac93c009 +size 2177590 diff --git a/LibreOJ/2173/data/building7.in b/LibreOJ/2173/data/building7.in new file mode 100644 index 00000000..4d0816c2 --- /dev/null +++ b/LibreOJ/2173/data/building7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c4b3a0926c8fe58bb3813bdfdcb47aa2af3447871644d75fc73178f10093e167 +size 2567788 diff --git a/LibreOJ/2173/data/building7.out b/LibreOJ/2173/data/building7.out new file mode 100644 index 00000000..a430301f --- /dev/null +++ b/LibreOJ/2173/data/building7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a296863f2a651cc5a1bd6bd6531a883368ef1f2e5cd4866f8a45a9d623914555 +size 2177459 diff --git a/LibreOJ/2173/data/building8.in b/LibreOJ/2173/data/building8.in new file mode 100644 index 00000000..7d181de5 --- /dev/null +++ b/LibreOJ/2173/data/building8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c67fde884f37b816ae0a4be091c6302db6813c1315c8889d5f35a0d761038357 +size 2567920 diff --git a/LibreOJ/2173/data/building8.out b/LibreOJ/2173/data/building8.out new file mode 100644 index 00000000..8beed218 --- /dev/null +++ b/LibreOJ/2173/data/building8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07404b0fcd2e06b6f08d38dc0dd0129da83b3cd372136c0a7b819428fb629aa7 +size 2177736 diff --git a/LibreOJ/2173/data/building9.in b/LibreOJ/2173/data/building9.in new file mode 100644 index 00000000..ca34387e --- /dev/null +++ b/LibreOJ/2173/data/building9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dcdd68ac150e7b1b23e11aca7a07e9d315e2fcc6255caf3688e8d9e8bfbc6d6b +size 2567647 diff --git a/LibreOJ/2173/data/building9.out b/LibreOJ/2173/data/building9.out new file mode 100644 index 00000000..d2b7daa1 --- /dev/null +++ b/LibreOJ/2173/data/building9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8cdf6d78db8d7210a328b60cf004d7996432ebf6e16abe67b1c2280b18aa8dde +size 2177643