QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#265725 | #5103. Fair Division | juampi | Compile Error | / | / | Python3 | 855b | 2023-11-25 20:39:57 | 2023-11-25 20:39:57 |
Judging History
answer
import math
while True:
try:
N, M = map(int, input().split())
if N > 200:
N = 200
p, q = None, None
pw = [0, 0]
for q in range(2, int(1e6)):
pw.append(math.pow(q, N))
for p in range(1, q):
d = pw[q] - pw[q - p]
if d > 1.1 * M * q:
if p == 1:
raise Exception
continue
qp = 1
pp = 1
for i in range(N):
qp *= q
for i in range(N):
pp *= (q - p)
if M * p % (qp - pp) == 0:
raise StopIteration
print(p, q)
except StopIteration:
continue
except Exception:
print("impossible")
```
Details
File "answer.code", line 33 ``` ^ SyntaxError: invalid syntax