QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#89906 | #5103. Fair Division | _skb_# | WA | 2ms | 3564kb | C++20 | 918b | 2023-03-21 19:17:25 | 2023-03-21 19:17:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
__int128_t bp(__int128_t a, __int128_t p) {
if (p == 0) return 1LL;
__int128_t ret = bp(a, p / 2);
ret *= ret;
if (p & 1) ret *= a;
return ret;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long long nn, mm; cin >> nn >> mm;
__int128_t n = nn, m = mm;
int max_pow = ceil(pow(1e30, 1.0 / n));
__int128_t pw[max_pow + 1];
pw[0] = 1;
for (int i = 1; i <= max_pow; ++i) pw[i] = bp(i, n);
for (__int128_t p = 1; p <= max_pow; ++p) {
for (__int128_t q = 1; q <= max_pow; ++q) {
if (p < q)
if (m * p * pw[q - p] % (pw[q] - pw[q - p]) == 0) {
cout << (long long) p << ' '
<< (long long) q << '\n';
return 0;
}
}
}
cout << "impossible\n";
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 3512kb
input:
13 382475111752106101
output:
17 28
result:
ok single line: '17 28'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3508kb
input:
59 576460752303423487
output:
1 2
result:
ok single line: '1 2'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3336kb
input:
15 227368755046033249
output:
13 14
result:
ok single line: '13 14'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
27 72027091647987988
output:
1 4
result:
ok single line: '1 4'
Test #5:
score: -100
Wrong Answer
time: 2ms
memory: 3564kb
input:
12 817283057828223168
output:
5 10
result:
wrong answer 1st lines differ - expected: '10 17', found: '5 10'