A Math Problem (Easy)


Submit solution

Points: 7
Time limit: 1.0s
Python 2 2.0s
Python 3 2.0s
Memory limit: 128M

Author:
Problem types
Allowed languages
Assembly, Awk, Brain****, C, C++, Java, Pascal, Perl, Python, Text

Bob has been given a boring math problem:

Find a set of 3 non-negative integers denoted as X, Y, and Z, which satisfy the following two equations:

  • XYZ=A
  • X2+Y2+Z2=B

Bob has too little time to do this problem. Can you do this for Bob instead?

Input Specification

The first line of the input will contain two integers A and B, where 0A,B106.

Output Specification

In one line, output the three corresponding integers of X, Y, and Z, each separated by a space. If there is more than one possible solution, choose the one with the smallest X value. If there is still a tie, choose the solution with the smallest Y value.

If there are no possible combinations, output -1 instead.

Sample Input

Copy
15 35

Sample Output

Copy
1 3 5

Comments

There are no comments at the moment.