QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#87885 | #5103. Fair Division | zoker | WA | 12ms | 7872kb | Python3 | 407b | 2023-03-14 18:07:03 | 2023-03-14 18:07:05 |
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 = 3000
if n > 60:
print("impossible")
exit(0)
for q in range(2, N):
for p in range(q - 1, 0, -1):
t = (q ** n - p ** n) // (q - p)
if (t > m):
break
if(m % t == 0):
print(q - p, q)
exit(0)
print("impossible")
詳細信息
Test #1:
score: 0
Wrong Answer
time: 12ms
memory: 7872kb
input:
13 382475111752106101
output:
impossible
result:
wrong answer 1st lines differ - expected: '17 28', found: 'impossible'