diff --git a/LibreOJ/2361/2361.cpp b/LibreOJ/2361/2361.cpp new file mode 100644 index 00000000..2c079e0f --- /dev/null +++ b/LibreOJ/2361/2361.cpp @@ -0,0 +1,43 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 2005; + +int t, k, n, m, c[N][N], f[N][N]; + +int main() { + cin >> t >> k; + + c[1][1] = 1; + for (int i = 1; i <= 2000; i++) { + c[i][0] = c[i][i] = 1; + } + + for (int i = 2; i <= 2000; i++) { + for (int j = 1; j < i; j++) { + c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % k; + } + } + + for (int i = 1; i <= 2000; i++) { + for (int j = 1; j <= i; j++) { + f[i][j] = f[i][j - 1] + f[i - 1][j] - f[i - 1][j - 1]; + if (!c[i][j]) f[i][j]++; + } + + f[i][i + 1] = f[i][i]; + } + + while (t--) { + cin >> n >> m; + + std::cerr << n << m << endl; + + cout << f[n][std::min(n, m)] << endl; + } + + return 0; +} diff --git a/LibreOJ/2361/data/problem1.ans b/LibreOJ/2361/data/problem1.ans new file mode 100644 index 00000000..804fcc90 --- /dev/null +++ b/LibreOJ/2361/data/problem1.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa +size 2 diff --git a/LibreOJ/2361/data/problem1.in b/LibreOJ/2361/data/problem1.in new file mode 100644 index 00000000..13a59641 --- /dev/null +++ b/LibreOJ/2361/data/problem1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:03456f71f12b51c7bfe578337dfa1b36698dc19dd1c38bc1355bd9289d2ea75b +size 8 diff --git a/LibreOJ/2361/data/problem10.ans b/LibreOJ/2361/data/problem10.ans new file mode 100644 index 00000000..3e33f7d4 --- /dev/null +++ b/LibreOJ/2361/data/problem10.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6ca8be3970b570af7ee0179f5bf63503028b2915ea227a394f5bcbc12dfb5b9d +size 22240 diff --git a/LibreOJ/2361/data/problem10.in b/LibreOJ/2361/data/problem10.in new file mode 100644 index 00000000..fa2ea6dc --- /dev/null +++ b/LibreOJ/2361/data/problem10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51170ceddb9a398f570a0cd59c34d99ccf75dfba46adff549123fb2319a9cbc0 +size 55147 diff --git a/LibreOJ/2361/data/problem11.ans b/LibreOJ/2361/data/problem11.ans new file mode 100644 index 00000000..aeeaed3c --- /dev/null +++ b/LibreOJ/2361/data/problem11.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23c9dbf723bbdcf3bba5611781271d754e74269c6c5b066e12ccd9405cd9b7e4 +size 4 diff --git a/LibreOJ/2361/data/problem11.in b/LibreOJ/2361/data/problem11.in new file mode 100644 index 00000000..183c76f3 --- /dev/null +++ b/LibreOJ/2361/data/problem11.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f4b8334d0a2fd43142080faaa7504e48de025e2847aa73748e30f7dd5a45a1d +size 11 diff --git a/LibreOJ/2361/data/problem12.ans b/LibreOJ/2361/data/problem12.ans new file mode 100644 index 00000000..6912e46d --- /dev/null +++ b/LibreOJ/2361/data/problem12.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d483465cbad28e99f7f5cce054339aeb822ba0cfae876615dbe128803ad3c734 +size 27583 diff --git a/LibreOJ/2361/data/problem12.in b/LibreOJ/2361/data/problem12.in new file mode 100644 index 00000000..06ec5580 --- /dev/null +++ b/LibreOJ/2361/data/problem12.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af2bdb77b5bb0013ba50aad57a8ed1b7301bb91fcd3e9e2fdd2fe153e1557237 +size 43307 diff --git a/LibreOJ/2361/data/problem13.ans b/LibreOJ/2361/data/problem13.ans new file mode 100644 index 00000000..acc4803c --- /dev/null +++ b/LibreOJ/2361/data/problem13.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5baa2977d74c91e4549e1b0f0be331761c8b4eb910feb9dfb6f91bbc53fa174 +size 4 diff --git a/LibreOJ/2361/data/problem13.in b/LibreOJ/2361/data/problem13.in new file mode 100644 index 00000000..8bd9187d --- /dev/null +++ b/LibreOJ/2361/data/problem13.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51064a4ec3ad8b0616b50deadc824216c46cd364e7d49ca8e404d89619c4e059 +size 11 diff --git a/LibreOJ/2361/data/problem14.ans b/LibreOJ/2361/data/problem14.ans new file mode 100644 index 00000000..ba3b9888 --- /dev/null +++ b/LibreOJ/2361/data/problem14.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c3bc6543b8d091745898de1ba54c4f3235bd2f49abca304c0132ad04890655c7 +size 22469 diff --git a/LibreOJ/2361/data/problem14.in b/LibreOJ/2361/data/problem14.in new file mode 100644 index 00000000..dad0577a --- /dev/null +++ b/LibreOJ/2361/data/problem14.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e380dd0783ee26209d00858d0d540a24ccb99c89df7706f1e5f6f2bc1edda43b +size 34048 diff --git a/LibreOJ/2361/data/problem15.ans b/LibreOJ/2361/data/problem15.ans new file mode 100644 index 00000000..db70a282 --- /dev/null +++ b/LibreOJ/2361/data/problem15.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf5425a7ecee3ea8d05e8e14bd1a65bf1ff8a2460fc00f326536ecd6e932a56a +size 5 diff --git a/LibreOJ/2361/data/problem15.in b/LibreOJ/2361/data/problem15.in new file mode 100644 index 00000000..66f12e05 --- /dev/null +++ b/LibreOJ/2361/data/problem15.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c9b60829cf38914c4ae747465def7e086321a073e2b1043a9fb0ff71bfc54293 +size 11 diff --git a/LibreOJ/2361/data/problem16.ans b/LibreOJ/2361/data/problem16.ans new file mode 100644 index 00000000..71aaf236 --- /dev/null +++ b/LibreOJ/2361/data/problem16.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07baacb9d6419cede5728653f66502e484ecc3ab6bf3f3204a8bf157d02c23db +size 36727 diff --git a/LibreOJ/2361/data/problem16.in b/LibreOJ/2361/data/problem16.in new file mode 100644 index 00000000..aa26d914 --- /dev/null +++ b/LibreOJ/2361/data/problem16.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e34a74ec9c8452647e980d3bbc83288d9343b8044f08f0f14ecfab1d6cce9d1 +size 52458 diff --git a/LibreOJ/2361/data/problem17.ans b/LibreOJ/2361/data/problem17.ans new file mode 100644 index 00000000..dd6f5e8e --- /dev/null +++ b/LibreOJ/2361/data/problem17.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb3c8cca7b69a30531d18bddb45e99731d29bf726f54417da186630bf86c82a4 +size 6 diff --git a/LibreOJ/2361/data/problem17.in b/LibreOJ/2361/data/problem17.in new file mode 100644 index 00000000..ddea4565 --- /dev/null +++ b/LibreOJ/2361/data/problem17.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9216fd678ca6efd7b415f59cf29ff329e9b2b073ae5abcad28f08f92dfcb7c24 +size 13 diff --git a/LibreOJ/2361/data/problem18.ans b/LibreOJ/2361/data/problem18.ans new file mode 100644 index 00000000..854933ae --- /dev/null +++ b/LibreOJ/2361/data/problem18.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58eb544691935d8cf616b0e425a83892cdc4786858389802e5dcf3917401abcd +size 36679 diff --git a/LibreOJ/2361/data/problem18.in b/LibreOJ/2361/data/problem18.in new file mode 100644 index 00000000..fb4c1be2 --- /dev/null +++ b/LibreOJ/2361/data/problem18.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55cf318f7233f2884ea598f8c9c8507961566d8929324c5f3a7f4e92fa9cf374 +size 50218 diff --git a/LibreOJ/2361/data/problem19.ans b/LibreOJ/2361/data/problem19.ans new file mode 100644 index 00000000..50802c92 --- /dev/null +++ b/LibreOJ/2361/data/problem19.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81336baa7b00956da0e7806a1e3e986be64a30d677881a76847c81ea0c462942 +size 7 diff --git a/LibreOJ/2361/data/problem19.in b/LibreOJ/2361/data/problem19.in new file mode 100644 index 00000000..6d33983d --- /dev/null +++ b/LibreOJ/2361/data/problem19.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38cca3102c1bd6f86878d4776307254634a6c8ec20e96c918ba0f2fe9b178739 +size 15 diff --git a/LibreOJ/2361/data/problem2.ans b/LibreOJ/2361/data/problem2.ans new file mode 100644 index 00000000..bf9b9209 --- /dev/null +++ b/LibreOJ/2361/data/problem2.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d48bd336ec84ebb1addc64863ffb1b28f11ee7a1bee25d2aa636ff9a4d3338d0 +size 17804 diff --git a/LibreOJ/2361/data/problem2.in b/LibreOJ/2361/data/problem2.in new file mode 100644 index 00000000..1134ace7 --- /dev/null +++ b/LibreOJ/2361/data/problem2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0499ef7cc79545630070b06638918469b1f4c22bc6ee08ace3655cbe1e112b17 +size 35615 diff --git a/LibreOJ/2361/data/problem20.ans b/LibreOJ/2361/data/problem20.ans new file mode 100644 index 00000000..e6413531 --- /dev/null +++ b/LibreOJ/2361/data/problem20.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae3addec7e6d2dce194b6e9d4b1d826998a753b04fa13a8a7cd8e60dfdff0389 +size 41033 diff --git a/LibreOJ/2361/data/problem20.in b/LibreOJ/2361/data/problem20.in new file mode 100644 index 00000000..1f98b93b --- /dev/null +++ b/LibreOJ/2361/data/problem20.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cfe99a9e984088833edc02cb19f107f777c2a79b859b66a175d099ed3d2736c1 +size 54799 diff --git a/LibreOJ/2361/data/problem3.ans b/LibreOJ/2361/data/problem3.ans new file mode 100644 index 00000000..38118f32 --- /dev/null +++ b/LibreOJ/2361/data/problem3.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53c234e5e8472b6ac51c1ae1cab3fe06fad053beb8ebfd8977b010655bfdd3c3 +size 2 diff --git a/LibreOJ/2361/data/problem3.in b/LibreOJ/2361/data/problem3.in new file mode 100644 index 00000000..b35cef31 --- /dev/null +++ b/LibreOJ/2361/data/problem3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59e2d550310ab83cc593c702dcf3287bb50b7e68ca27dbc28a8bc010ddb66512 +size 8 diff --git a/LibreOJ/2361/data/problem4.ans b/LibreOJ/2361/data/problem4.ans new file mode 100644 index 00000000..efdd6bbb --- /dev/null +++ b/LibreOJ/2361/data/problem4.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c71a0e256fce9d2e86ce7433bb2c67fd71eeb8e892406ebfddb2cb34fc9d5b2c +size 10284 diff --git a/LibreOJ/2361/data/problem4.in b/LibreOJ/2361/data/problem4.in new file mode 100644 index 00000000..7caa1ddf --- /dev/null +++ b/LibreOJ/2361/data/problem4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e07ddab1c162c5328a13b69258166bcb6b7473b4fd0693886c21d44f0aa5bc1c +size 20575 diff --git a/LibreOJ/2361/data/problem5.ans b/LibreOJ/2361/data/problem5.ans new file mode 100644 index 00000000..ca267b30 --- /dev/null +++ b/LibreOJ/2361/data/problem5.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1121cfccd5913f0a63fec40a6ffd44ea64f9dc135c66634ba001d10bcf4302a2 +size 2 diff --git a/LibreOJ/2361/data/problem5.in b/LibreOJ/2361/data/problem5.in new file mode 100644 index 00000000..78afcce2 --- /dev/null +++ b/LibreOJ/2361/data/problem5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e005fc45c6bc87c2382f2b18cfb0be75ba92e04f0509bc76da1f1c527d90d6a0 +size 8 diff --git a/LibreOJ/2361/data/problem6.ans b/LibreOJ/2361/data/problem6.ans new file mode 100644 index 00000000..4d622050 --- /dev/null +++ b/LibreOJ/2361/data/problem6.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:daf93574dda790a5466716c11aba3c8c58c85ada7f8c09aef5af29f63ab806c6 +size 19441 diff --git a/LibreOJ/2361/data/problem6.in b/LibreOJ/2361/data/problem6.in new file mode 100644 index 00000000..b7dce473 --- /dev/null +++ b/LibreOJ/2361/data/problem6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a37af3e9843910d7fd54fcdd16d6c0589fb03fef7acdb827cc45ce3486b97761 +size 37564 diff --git a/LibreOJ/2361/data/problem7.ans b/LibreOJ/2361/data/problem7.ans new file mode 100644 index 00000000..ad2c816c --- /dev/null +++ b/LibreOJ/2361/data/problem7.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3840bc236ee03aacbb1ef7d5108ddfa347c59f10b68d4174affbb53140f31273 +size 3 diff --git a/LibreOJ/2361/data/problem7.in b/LibreOJ/2361/data/problem7.in new file mode 100644 index 00000000..69cf21cb --- /dev/null +++ b/LibreOJ/2361/data/problem7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3fc3750093659efd8cf2ee4f5db75a318b11531335371158f1674b665f5889bc +size 10 diff --git a/LibreOJ/2361/data/problem8.ans b/LibreOJ/2361/data/problem8.ans new file mode 100644 index 00000000..05248c1c --- /dev/null +++ b/LibreOJ/2361/data/problem8.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad53955ea992a7f15e4ec0695829562678a31bc1133bbbf493082ec3b6b24297 +size 14671 diff --git a/LibreOJ/2361/data/problem8.in b/LibreOJ/2361/data/problem8.in new file mode 100644 index 00000000..afb237b6 --- /dev/null +++ b/LibreOJ/2361/data/problem8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:faf30fa18ae62f804a4a6f6365b2f3ee63b35f44b4b0b469f3386dec8af03b2c +size 33063 diff --git a/LibreOJ/2361/data/problem9.ans b/LibreOJ/2361/data/problem9.ans new file mode 100644 index 00000000..da505980 --- /dev/null +++ b/LibreOJ/2361/data/problem9.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2a57042a43991d2ca310938e6802d7283954e38c825a548c4bee89c45238b43b +size 3 diff --git a/LibreOJ/2361/data/problem9.in b/LibreOJ/2361/data/problem9.in new file mode 100644 index 00000000..ed9a6217 --- /dev/null +++ b/LibreOJ/2361/data/problem9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f12ab1d24bb53e8f1c0eebdc678985b9b0e8243c0965939f03ec90852004716 +size 13