From 58a87a54d676fc71463d61f1b3af2f4be91d282c Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Tue, 14 Feb 2023 20:37:38 +0800 Subject: [PATCH] =?UTF-8?q?#151.=20=E3=80=902020.12.1=20NOIP=E6=A8=A1?= =?UTF-8?q?=E6=8B=9F=E8=B5=9B=20T4=E3=80=91=E5=81=B7=E7=A8=8E=E8=AE=A1?= =?UTF-8?q?=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sjzezoj.com/submission/70023 --- S2OJ/151/151.cpp | 95 ++++++++++++++++++++++++++++++++++++++ S2OJ/151/data/mod1.ans | 3 ++ S2OJ/151/data/mod1.in | 3 ++ S2OJ/151/data/mod10.ans | 3 ++ S2OJ/151/data/mod10.in | 3 ++ S2OJ/151/data/mod11.ans | 3 ++ S2OJ/151/data/mod11.in | 3 ++ S2OJ/151/data/mod2.ans | 3 ++ S2OJ/151/data/mod2.in | 3 ++ S2OJ/151/data/mod3.ans | 3 ++ S2OJ/151/data/mod3.in | 3 ++ S2OJ/151/data/mod4.ans | 3 ++ S2OJ/151/data/mod4.in | 3 ++ S2OJ/151/data/mod5.ans | 3 ++ S2OJ/151/data/mod5.in | 3 ++ S2OJ/151/data/mod6.ans | 3 ++ S2OJ/151/data/mod6.in | 3 ++ S2OJ/151/data/mod7.ans | 3 ++ S2OJ/151/data/mod7.in | 3 ++ S2OJ/151/data/mod8.ans | 3 ++ S2OJ/151/data/mod8.in | 3 ++ S2OJ/151/data/mod9.ans | 3 ++ S2OJ/151/data/mod9.in | 3 ++ S2OJ/151/data/problem.conf | 3 ++ 24 files changed, 164 insertions(+) create mode 100644 S2OJ/151/151.cpp create mode 100644 S2OJ/151/data/mod1.ans create mode 100644 S2OJ/151/data/mod1.in create mode 100644 S2OJ/151/data/mod10.ans create mode 100644 S2OJ/151/data/mod10.in create mode 100644 S2OJ/151/data/mod11.ans create mode 100644 S2OJ/151/data/mod11.in create mode 100644 S2OJ/151/data/mod2.ans create mode 100644 S2OJ/151/data/mod2.in create mode 100644 S2OJ/151/data/mod3.ans create mode 100644 S2OJ/151/data/mod3.in create mode 100644 S2OJ/151/data/mod4.ans create mode 100644 S2OJ/151/data/mod4.in create mode 100644 S2OJ/151/data/mod5.ans create mode 100644 S2OJ/151/data/mod5.in create mode 100644 S2OJ/151/data/mod6.ans create mode 100644 S2OJ/151/data/mod6.in create mode 100644 S2OJ/151/data/mod7.ans create mode 100644 S2OJ/151/data/mod7.in create mode 100644 S2OJ/151/data/mod8.ans create mode 100644 S2OJ/151/data/mod8.in create mode 100644 S2OJ/151/data/mod9.ans create mode 100644 S2OJ/151/data/mod9.in create mode 100644 S2OJ/151/data/problem.conf diff --git a/S2OJ/151/151.cpp b/S2OJ/151/151.cpp new file mode 100644 index 00000000..cf0683c1 --- /dev/null +++ b/S2OJ/151/151.cpp @@ -0,0 +1,95 @@ +#include +#include +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 1e5 + 5, + M = 105; +const int mod = 1e9 + 7; +const int p[]{2, 3, 5, 7}; + +int cnt, f[M][M][(1 << 4) + 5]; +std::vector> v[M], a[M]; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + for (int i = 2; i <= 100; i++) { + int x = i, s = 0; + + for (int j = 0; j < 4; j++) { + while (x && x % p[j] == 0) { + x /= p[j]; + s |= 1 << j; + } + } + + v[x].emplace_back(i, s); + } + + for (auto o : v[1]) { + a[++cnt].emplace_back(o); + } + + for (int i = 2; i <= 100; i++) { + if (v[i].empty()) continue; + + cnt++; + + for (auto o : v[i]) { + a[cnt].emplace_back(o); + } + } + + int t; + + cin >> t; + + while (t--) { + int n, m; + + cin >> n >> m; + + memset(f, 0x00, sizeof(f)); + + f[0][0][0] = 1; + + for (int i = 1; i <= cnt; i++) { + for (int j = 0; j <= i; j++) { + for (int s = 0; s < 1 << 4; s++) { + if (f[i - 1][j][s]) { + f[i][j][s] = (static_cast(f[i][j][s]) + f[i - 1][j][s]) % mod; + + for (auto o : a[i]) { + if (o.first > m) break; + + if (!(s & o.second)) { + f[i][j + 1][s | o.second] + = (static_cast(f[i][j + 1][s | o.second]) + + static_cast(f[i - 1][j][s]) * (n - j)) + % mod; + } + } + } + } + } + } + + int ans = 0; + + for (int j = 0; j <= cnt; j++) { + for (int s = 0; s < 1 << 4; s++) { + ans = (static_cast(ans) + f[cnt][j][s]) % mod; + } + } + + cout << ans << endl; + } + + return 0; +} diff --git a/S2OJ/151/data/mod1.ans b/S2OJ/151/data/mod1.ans new file mode 100644 index 00000000..1f6b4acf --- /dev/null +++ b/S2OJ/151/data/mod1.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bda02870a551dd881b136bc773f689769239ffcb36866d289dfba522bf504a08 +size 4933 diff --git a/S2OJ/151/data/mod1.in b/S2OJ/151/data/mod1.in new file mode 100644 index 00000000..ebfbb5d5 --- /dev/null +++ b/S2OJ/151/data/mod1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37cd12984d84c3ccedc91609ffd597d509e34d7a9bc7e481711ee547d9de37bd +size 4722 diff --git a/S2OJ/151/data/mod10.ans b/S2OJ/151/data/mod10.ans new file mode 100644 index 00000000..68d08f99 --- /dev/null +++ b/S2OJ/151/data/mod10.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b214686499ef32ee8a2d1fd9e0e9a7f0afa632b1e323a67416fdaabe4c0a44fe +size 4949 diff --git a/S2OJ/151/data/mod10.in b/S2OJ/151/data/mod10.in new file mode 100644 index 00000000..573b69af --- /dev/null +++ b/S2OJ/151/data/mod10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e04f410f662eafdd0dabc838878a0ddae36ae0a445a0b23e22830c1b37a44362 +size 4485 diff --git a/S2OJ/151/data/mod11.ans b/S2OJ/151/data/mod11.ans new file mode 100644 index 00000000..8bb8fe3d --- /dev/null +++ b/S2OJ/151/data/mod11.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b2a87c6b915114a476b6597c0b8f92a4ccf13c62b488420e26e5e847c1677dc +size 4947 diff --git a/S2OJ/151/data/mod11.in b/S2OJ/151/data/mod11.in new file mode 100644 index 00000000..ada92ae5 --- /dev/null +++ b/S2OJ/151/data/mod11.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1fb8f05109613e761572310ab86ff53150e73e5c1e38cfcae7d278851ab58ffd +size 4957 diff --git a/S2OJ/151/data/mod2.ans b/S2OJ/151/data/mod2.ans new file mode 100644 index 00000000..be23715a --- /dev/null +++ b/S2OJ/151/data/mod2.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52c6d76b1f714dec56b31bd1821fd6335fc0104e0fac5a76e1aeb4eae81de879 +size 26 diff --git a/S2OJ/151/data/mod2.in b/S2OJ/151/data/mod2.in new file mode 100644 index 00000000..a87c9ec8 --- /dev/null +++ b/S2OJ/151/data/mod2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:abac81142fbebe9538da62ac835142aac9fdff6a2e229d931036f45ee239a3aa +size 43 diff --git a/S2OJ/151/data/mod3.ans b/S2OJ/151/data/mod3.ans new file mode 100644 index 00000000..ed024a28 --- /dev/null +++ b/S2OJ/151/data/mod3.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8bccb132320c9db9c0c90865072fa9fb185fe8180bc53d61be30bba4a7faa58 +size 85 diff --git a/S2OJ/151/data/mod3.in b/S2OJ/151/data/mod3.in new file mode 100644 index 00000000..6e2920ea --- /dev/null +++ b/S2OJ/151/data/mod3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79b0554ceced5b3f2da987a67e1bbd6b2c2d017d502a518ae8899d1b4bdca252 +size 60 diff --git a/S2OJ/151/data/mod4.ans b/S2OJ/151/data/mod4.ans new file mode 100644 index 00000000..27e395b1 --- /dev/null +++ b/S2OJ/151/data/mod4.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b546d6092148584e50f78d22d20bf4419facc6046d8b4e9a73d01bda1c86d0fe +size 66 diff --git a/S2OJ/151/data/mod4.in b/S2OJ/151/data/mod4.in new file mode 100644 index 00000000..c5146cd5 --- /dev/null +++ b/S2OJ/151/data/mod4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:697a6dda362b718922b50179928a38bc69b087047b20760ffaa6eaf8c87899a2 +size 56 diff --git a/S2OJ/151/data/mod5.ans b/S2OJ/151/data/mod5.ans new file mode 100644 index 00000000..3eae2405 --- /dev/null +++ b/S2OJ/151/data/mod5.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b71b662c47fcbebe8eb1dfd807db4260d333389387efd714ce263d66124b6416 +size 98 diff --git a/S2OJ/151/data/mod5.in b/S2OJ/151/data/mod5.in new file mode 100644 index 00000000..bdc3808b --- /dev/null +++ b/S2OJ/151/data/mod5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5ff501e537c5c9e9cdcd63ed1927d4fb09fd933d017d23836986a6de29caf0f +size 93 diff --git a/S2OJ/151/data/mod6.ans b/S2OJ/151/data/mod6.ans new file mode 100644 index 00000000..0fb2d703 --- /dev/null +++ b/S2OJ/151/data/mod6.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6592a8bf49d996fa72aee11fcabf21e8b01baa17f653358c7351f2721b0adb93 +size 92 diff --git a/S2OJ/151/data/mod6.in b/S2OJ/151/data/mod6.in new file mode 100644 index 00000000..49caa55a --- /dev/null +++ b/S2OJ/151/data/mod6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1b0a214981d50e1571b2e989541a2b44149b07a08b22f3b581efca4a0ec54f0 +size 92 diff --git a/S2OJ/151/data/mod7.ans b/S2OJ/151/data/mod7.ans new file mode 100644 index 00000000..c638cac7 --- /dev/null +++ b/S2OJ/151/data/mod7.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aebb6c225d3b4141716cd34542e08b02951fd3b28450087a7adeac836b0bf7d5 +size 99 diff --git a/S2OJ/151/data/mod7.in b/S2OJ/151/data/mod7.in new file mode 100644 index 00000000..823b3e4b --- /dev/null +++ b/S2OJ/151/data/mod7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb73e64543e33d1a94aa91dfb6672825dd3d5d2e8942c74d08606ae96fa73180 +size 91 diff --git a/S2OJ/151/data/mod8.ans b/S2OJ/151/data/mod8.ans new file mode 100644 index 00000000..e7ed7792 --- /dev/null +++ b/S2OJ/151/data/mod8.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:06bc0c5aa91f0cf6ac4af669783f48b53154e9793538d66b8494299876d9442f +size 98 diff --git a/S2OJ/151/data/mod8.in b/S2OJ/151/data/mod8.in new file mode 100644 index 00000000..46efa544 --- /dev/null +++ b/S2OJ/151/data/mod8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e98e90ab6aeb5b7372d68a91aa6945d4e5d8cd4c286855f4417c632d587c13e +size 89 diff --git a/S2OJ/151/data/mod9.ans b/S2OJ/151/data/mod9.ans new file mode 100644 index 00000000..bf7c07af --- /dev/null +++ b/S2OJ/151/data/mod9.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30e2421115f0c83918c7ea0830c5e3a8a954c4db1c223ba716c81e61082e813a +size 4922 diff --git a/S2OJ/151/data/mod9.in b/S2OJ/151/data/mod9.in new file mode 100644 index 00000000..23da01be --- /dev/null +++ b/S2OJ/151/data/mod9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55d624ae567eee1d4b1e165e077bd2f68a5791d5a0342586c6e1ecc19accfeb7 +size 4411 diff --git a/S2OJ/151/data/problem.conf b/S2OJ/151/data/problem.conf new file mode 100644 index 00000000..fc67b4ab --- /dev/null +++ b/S2OJ/151/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c35e64331b5b3914e7b6b2e8159aa9c2b3d8f26016d3b867a68e13f4cd5af8c +size 209