QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#87883 | #5103. Fair Division | zoker | WA | 10ms | 7936kb | Python3 | 442b | 2023-03-14 18:03:46 | 2023-03-14 18:03:48 |
Judging History
answer
import math
def ok(n, m, p, q):
if (n > 60):
return False
return m % ((p ** n - q ** n) // (p - q)) == 0
n, m = map(int, input().split())
N = 2000
if n > 60:
print("impossible")
exit(0)
for q in range(2, N):
for p in range(q - 1, 0, -1):
g = math.gcd(p,q)
if g != 1:
continue
if (q ** n - p ** n > m * (q - p)):
break
if(ok(n, m, p, q)):
print(q - p, q)
exit(0)
print("impossible")
詳細信息
Test #1:
score: 0
Wrong Answer
time: 10ms
memory: 7936kb
input:
13 382475111752106101
output:
impossible
result:
wrong answer 1st lines differ - expected: '17 28', found: 'impossible'