QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#352607 | #5103. Fair Division | PorNPtree# | WA | 2ms | 3740kb | C++14 | 764b | 2024-03-13 13:59:28 | 2024-03-13 13:59:28 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
signed main()
{
int n;
long long m;
scanf("%d%lld", &n, &m);
if (n < 100) {
for (int q = 2; q <= 100; ++q) {
for (int p = 1; p < q; ++p) {
long double t = (long double)p / q, now = (1 - t) / (1 - pow(t, n)) * m;
int flg = (fabs(now - floor(now + 0.5)) < 1e-6);
for (int z = 1; z < n && flg; ++z) {
now *= t;
flg &= (fabs(now - floor(now + 0.5)) < 1e-6);
}
if (flg) {
printf("%d %d\n", q - p, q);
return 0;
}
}
}
}
puts("impossible");
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3740kb
input:
13 382475111752106101
output:
impossible
result:
wrong answer 1st lines differ - expected: '17 28', found: 'impossible'