Problem | Verdict | Lang | Time | Best | Rank | Submit Time |
---|---|---|---|---|---|---|
| discuss11428 - | Accepted | Python | 0.020 | 0.000 | 2929 | 1 mins ago |
Suggest:
61^3 - 60^3 > 10000 so x_max <= 60
r = {}
for x in range(1, 61):
for y in range(1, x):
if x**3-y**3 in r:
u, v = r[x**3-y**3]
if (v > y):
r[x**3-y**3] = (x,y)
else:
r[x**3-y**3] = (x,y)
while True:
n = int(input())
if n == 0:
break
if n not in r:
print('No solution')
else:
x, y = r[n]
print(f"{x} {y}")
No comments:
Post a Comment