QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#89934#5103. Fair Division_skb_#WA 13ms7948kbPython3434b2023-03-21 20:13:562023-03-21 20:14:00

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:14:00]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:7948kb
  • [2023-03-21 20:13:56]
  • 提交

answer

import math

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

max_pow = int(pow(1e19, 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 % (pw[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: 13ms
memory: 7948kb

input:

13 382475111752106101

output:

impossible

result:

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