Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- n = int(input())
- res = 'impossible'
- cub_root = n**(1/3)
- if abs(cub_root - round(cub_root)) < 1e-10:
- cub_root = round(cub_root)
- for i in range(math.floor(cub_root) + 1):
- rem = n - i ** 3
- root = rem ** (1/3)
- if abs(root - round(root)) < 1e-10:
- root = round(root)
- if int(root) ** 3 == rem:
- res = f'{i} {int(root)}'
- break
- print(res)
Advertisement
Add Comment
Please, Sign In to add comment