QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#89929#5103. Fair Division_skb_#WA 14ms7896kbPython3458b2023-03-21 20:04:292023-03-21 20:04:30

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-21 20:04:30]
  • 评测
  • 测评结果:WA
  • 用时:14ms
  • 内存:7896kb
  • [2023-03-21 20:04:29]
  • 提交

answer

import math

n, m = map(int, input().split())

max_pow = int(pow(1e20, 1.0 / n))
pw = []
pw.append(1)
for i in range(1, max_pow + 1):
    pw.append(pow(i, n))

for q in range(1, max_pow + 1):
    for p in range(1, max_pow + 1):
        if p < q and math.gcd(p, q) == 1:
            if m * p * pw[q - p] % (q * pw[q] - q * pw[q - p]) == 0:
                print(p, end=' ')
                print(q)
                exit(0)
print("impossible")

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 14ms
memory: 7896kb

input:

13 382475111752106101

output:

impossible

result:

wrong answer 1st lines differ - expected: '17 28', found: 'impossible'