0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 20:28:48 +00:00

3209. 花神的数论题

https://hydro.ac/d/bzoj/record/63159b6765233124267c21a2
This commit is contained in:
Baoshuo Ren 2022-09-05 14:47:04 +08:00
parent d08435a24b
commit 19f97c44bc
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
21 changed files with 116 additions and 0 deletions

56
BZOJ/3209/3209.cpp Normal file
View File

@ -0,0 +1,56 @@
#include <iostream>
#include <bitset>
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;
}

BIN
BZOJ/3209/data/1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
BZOJ/3209/data/9.out (Stored with Git LFS) Normal file

Binary file not shown.