mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 20:48:48 +00:00
parent
165b8e0dd1
commit
58a87a54d6
95
S2OJ/151/151.cpp
Normal file
95
S2OJ/151/151.cpp
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <cstring>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
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<std::pair<int, int>> 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<long long>(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<long long>(f[i][j + 1][s | o.second])
|
||||||
|
+ static_cast<long long>(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<long long>(ans) + f[cnt][j][s]) % mod;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << ans << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
S2OJ/151/data/mod1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod10.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod11.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod11.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod3.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod3.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod4.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod4.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod5.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod5.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod6.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod6.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod7.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod7.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod8.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod8.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod9.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod9.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/mod9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/mod9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/151/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/151/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user