From 19f97c44bceee6d0c1e4e64f4b2217dff901b0e0 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 5 Sep 2022 14:47:04 +0800 Subject: [PATCH] =?UTF-8?q?3209.=20=E8=8A=B1=E7=A5=9E=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E8=AE=BA=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://hydro.ac/d/bzoj/record/63159b6765233124267c21a2 --- BZOJ/3209/3209.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++ BZOJ/3209/data/1.in | 3 +++ BZOJ/3209/data/1.out | 3 +++ BZOJ/3209/data/10.in | 3 +++ BZOJ/3209/data/10.out | 3 +++ BZOJ/3209/data/2.in | 3 +++ BZOJ/3209/data/2.out | 3 +++ BZOJ/3209/data/3.in | 3 +++ BZOJ/3209/data/3.out | 3 +++ BZOJ/3209/data/4.in | 3 +++ BZOJ/3209/data/4.out | 3 +++ BZOJ/3209/data/5.in | 3 +++ BZOJ/3209/data/5.out | 3 +++ BZOJ/3209/data/6.in | 3 +++ BZOJ/3209/data/6.out | 3 +++ BZOJ/3209/data/7.in | 3 +++ BZOJ/3209/data/7.out | 3 +++ BZOJ/3209/data/8.in | 3 +++ BZOJ/3209/data/8.out | 3 +++ BZOJ/3209/data/9.in | 3 +++ BZOJ/3209/data/9.out | 3 +++ 21 files changed, 116 insertions(+) create mode 100644 BZOJ/3209/3209.cpp create mode 100644 BZOJ/3209/data/1.in create mode 100644 BZOJ/3209/data/1.out create mode 100644 BZOJ/3209/data/10.in create mode 100644 BZOJ/3209/data/10.out create mode 100644 BZOJ/3209/data/2.in create mode 100644 BZOJ/3209/data/2.out create mode 100644 BZOJ/3209/data/3.in create mode 100644 BZOJ/3209/data/3.out create mode 100644 BZOJ/3209/data/4.in create mode 100644 BZOJ/3209/data/4.out create mode 100644 BZOJ/3209/data/5.in create mode 100644 BZOJ/3209/data/5.out create mode 100644 BZOJ/3209/data/6.in create mode 100644 BZOJ/3209/data/6.out create mode 100644 BZOJ/3209/data/7.in create mode 100644 BZOJ/3209/data/7.out create mode 100644 BZOJ/3209/data/8.in create mode 100644 BZOJ/3209/data/8.out create mode 100644 BZOJ/3209/data/9.in create mode 100644 BZOJ/3209/data/9.out diff --git a/BZOJ/3209/3209.cpp b/BZOJ/3209/3209.cpp new file mode 100644 index 00000000..8e04281b --- /dev/null +++ b/BZOJ/3209/3209.cpp @@ -0,0 +1,56 @@ +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 70; +const int mod = 1e7 + 7; + +long long n, f[N][N][2], ans = 1; + +long long binpow(long long a, long long b) { + a %= mod; + + long long res = 1; + + while (b) { + if (b & 1) res = res * a % mod; + a = a * a % mod; + b >>= 1; + } + + return res; +} + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n; + + std::bitset<64> b(n); + + n = 64 - __builtin_clzll(n) - 1 + 1; + b <<= 1; + + f[0][0][1] = 1; + + for (int i = 0; i < n; i++) { + for (int j = 0; j <= i; j++) { + f[i + 1][j][0] += f[i][j][0]; + f[i + 1][j + 1][0] += f[i][j][0]; + f[i + 1][j][(b[i + 1] == 0)] += f[i][j][1]; + if (b[i + 1] == 1) f[i + 1][j + 1][1] += f[i][j][1]; + } + } + + for (int i = 1; i <= 64; i++) { + ans = ans * binpow(i, f[n][i][0] + f[n][i][1]) % mod; + } + + cout << ans << endl; + + return 0; +} diff --git a/BZOJ/3209/data/1.in b/BZOJ/3209/data/1.in new file mode 100644 index 00000000..06d04c2c --- /dev/null +++ b/BZOJ/3209/data/1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa67a169b0bba217aa0aa88a65346920c84c42447c36ba5f7ea65f422c1fe5d8 +size 2 diff --git a/BZOJ/3209/data/1.out b/BZOJ/3209/data/1.out new file mode 100644 index 00000000..ca08fd2c --- /dev/null +++ b/BZOJ/3209/data/1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68ca3fba3b7e864770cb61aeb306d4bd4354b68ab4dd38450860c5d823e42a53 +size 3 diff --git a/BZOJ/3209/data/10.in b/BZOJ/3209/data/10.in new file mode 100644 index 00000000..973eae03 --- /dev/null +++ b/BZOJ/3209/data/10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3afac0694e9cad388da6212fca59fc1290107079c4a1a7a7b22e09dfc9e2521 +size 15 diff --git a/BZOJ/3209/data/10.out b/BZOJ/3209/data/10.out new file mode 100644 index 00000000..370995f4 --- /dev/null +++ b/BZOJ/3209/data/10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe02f82263d6e65f073b1ea995c1cf71671b63cb1b93cc6034fd690456b6ec8a +size 8 diff --git a/BZOJ/3209/data/2.in b/BZOJ/3209/data/2.in new file mode 100644 index 00000000..022153ab --- /dev/null +++ b/BZOJ/3209/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:707199ff93700de9553b55bfa40fe8d2eb3fc6ff631bd10cc08f996a73c9ab66 +size 15 diff --git a/BZOJ/3209/data/2.out b/BZOJ/3209/data/2.out new file mode 100644 index 00000000..62b5ed26 --- /dev/null +++ b/BZOJ/3209/data/2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4281c6a9525676861a5332f421fb97bf99aa0491db4b5e80f5421922f933a1d3 +size 7 diff --git a/BZOJ/3209/data/3.in b/BZOJ/3209/data/3.in new file mode 100644 index 00000000..13e05173 --- /dev/null +++ b/BZOJ/3209/data/3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:085c348f64a3b543e973a33749e90ba20847b99016a87e5228847597d61ce582 +size 8 diff --git a/BZOJ/3209/data/3.out b/BZOJ/3209/data/3.out new file mode 100644 index 00000000..bc0225ac --- /dev/null +++ b/BZOJ/3209/data/3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b943c015764369104bc15a8457828e8943f1fdc74a8e6551c5d3062a97ac38c9 +size 8 diff --git a/BZOJ/3209/data/4.in b/BZOJ/3209/data/4.in new file mode 100644 index 00000000..94bfbcee --- /dev/null +++ b/BZOJ/3209/data/4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1107e553125aa5ac60288f146a711e9603b9350e332b7212e45b939d45c99cb +size 15 diff --git a/BZOJ/3209/data/4.out b/BZOJ/3209/data/4.out new file mode 100644 index 00000000..cf6a904c --- /dev/null +++ b/BZOJ/3209/data/4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9096c24d114555d458d22e5080a12ee6ec8e767ab97819e460b872ea64271084 +size 8 diff --git a/BZOJ/3209/data/5.in b/BZOJ/3209/data/5.in new file mode 100644 index 00000000..00d4f975 --- /dev/null +++ b/BZOJ/3209/data/5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea4855871993af61cfab0d1c654beb56ce117eacf6f2b8616ee55c61fff2c04d +size 15 diff --git a/BZOJ/3209/data/5.out b/BZOJ/3209/data/5.out new file mode 100644 index 00000000..90ae5247 --- /dev/null +++ b/BZOJ/3209/data/5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27e7703a2286c01531f16892e21dc640a2f62b65635738107f91fb0828837129 +size 8 diff --git a/BZOJ/3209/data/6.in b/BZOJ/3209/data/6.in new file mode 100644 index 00000000..1d6d09c9 --- /dev/null +++ b/BZOJ/3209/data/6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:604fec38960d7c5bd3bd6c06ad8f4b42eac0bb30ea02d43518d0f9f11d5e131e +size 11 diff --git a/BZOJ/3209/data/6.out b/BZOJ/3209/data/6.out new file mode 100644 index 00000000..cb823610 --- /dev/null +++ b/BZOJ/3209/data/6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0066237c0326ea9f24a45af8ce4b66b56427bb0a0291f1d115f2167cd77ca96 +size 8 diff --git a/BZOJ/3209/data/7.in b/BZOJ/3209/data/7.in new file mode 100644 index 00000000..122e0e0d --- /dev/null +++ b/BZOJ/3209/data/7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9bdb927de8a0a39cee716776fa76143b15ca2576548728829f4400ea54a59647 +size 17 diff --git a/BZOJ/3209/data/7.out b/BZOJ/3209/data/7.out new file mode 100644 index 00000000..32e34a40 --- /dev/null +++ b/BZOJ/3209/data/7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:308a1e7123de78ba6b25c74212b0f23d72c6bd65c49f678ad384ab61dad42eed +size 8 diff --git a/BZOJ/3209/data/8.in b/BZOJ/3209/data/8.in new file mode 100644 index 00000000..ac9fce6a --- /dev/null +++ b/BZOJ/3209/data/8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f3633c0ecb81f7639c3fe70873b438e74fb8960c68f7c39e6a8eac795e70a32 +size 6 diff --git a/BZOJ/3209/data/8.out b/BZOJ/3209/data/8.out new file mode 100644 index 00000000..b810f5e2 --- /dev/null +++ b/BZOJ/3209/data/8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0efeb0f042ad7de1f4dd883c776f1a8811c5fecf3ab8ea2abb0e79c6ba434310 +size 8 diff --git a/BZOJ/3209/data/9.in b/BZOJ/3209/data/9.in new file mode 100644 index 00000000..e16f06a1 --- /dev/null +++ b/BZOJ/3209/data/9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c9cd96c32d8ac05f1172d574fc5cf8fead79c0fe3026cd66c9d785620e32ae80 +size 11 diff --git a/BZOJ/3209/data/9.out b/BZOJ/3209/data/9.out new file mode 100644 index 00000000..14255966 --- /dev/null +++ b/BZOJ/3209/data/9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab9a898e8beb504338352cff17d5d47f0d92d71e8cf24134a3d38d500200e799 +size 8