Problem E
Floor Plan
You are an architect and you have just been appointed to build a new swimming hall. The organisation behind these plans has acquired funding for a swimming pool and surrounding building as large as they want, but unfortunately they could not find anyone willing to pay for the floor surrounding the pool. They decided to pay for the floor tiles out of their own pocket. Because this has already cost them an arm and a leg, they want you to use all the floor tiles in your proposed plan.
Being an architect, you care for aesthetics. You see it as absolutely vital that both the swimming pool and the surrounding building are perfect squares. This raises an interesting problem: how can you make sure that the square shapes are guaranteed, while still using all the floor tiles the organisation bought?
Given the number of tiles $n$, find the length of the side of the building $m$ and and the length of the side of the pool $k$ such that $n=m^2-k^2$, or print impossible if no suitable $m$ and $k$ exist.
Input
-
One line containing a single integer $1\leq n\leq 10^9$.
Output
Print two non-negative integers $m$, $k$ such that $n = m^2 - k^2$, or print impossible if no such integers exist. If there are multiple valid solutions, you may output any one of them.
Sample Input 1 | Sample Output 1 |
---|---|
7 |
4 3 |
Sample Input 2 | Sample Output 2 |
---|---|
10 |
impossible |
Sample Input 3 | Sample Output 3 |
---|---|
15 |
4 1 |