Diophantine Equation
Time limit1sMemory limit1024 MB
Given n up to 10^9 (T up to 3000 queries), find positive integers x and y with x^3 + y^3 = n^2, or report that none exist.
- Level
Medium6 of 10
- Topics
- Math, Number theory
- Solved
- No attempts yet
Problem
Bikarp has the square of a positive integer . He wants to split it into a sum of two cubes of positive integers. In other words, he wants to find positive integers and that solve the following Diophantine equation, where is fixed.
Find a solution, or determine that none exists.
Input
The first line contains , the number of test cases (). Each of the next lines contains a single integer ().
Output
Output lines. The -th line contains the answer for the -th test case: either "impossible" if cannot be decomposed, or two positive integers and . If a test case has several solutions, output any of them.