#K48087. Finding a Special Combination
Finding a Special Combination
Finding a Special Combination
Given a positive integer N, find a combination of three pairs of integers \((a, b)\), \((c, d)\) and \((e, f)\) satisfying the equation
[ a + b^2 + c + d^2 + e + f^2 = N ]
with the additional constraints:
- \(1 \le a, b, c, d, e, f \le 10^6\)
If there are multiple solutions, you may output any valid one. It is guaranteed that for the given input values there exists at least one valid solution.
Note: In this problem, you are required to read the input from standard input and write the output to standard output. The output should contain the 6 integers \(a, b, c, d, e, f\) separated by a single space.
Examples:
- For input
53
, one possible valid output is1 5 1 4 1 3
since \[ 1 + 5^2 + 1 + 4^2 + 1 + 3^2 = 1 + 25 + 1 + 16 + 1 + 9 = 53 \] - For input
220
, one possible valid output is1 12 1 8 1 3
since \[ 1 + 12^2 + 1 + 8^2 + 1 + 3^2 = 1 + 144 + 1 + 64 + 1 + 9 = 220 \] - For input
1000
, one possible valid output is1 30 1 9 1 4
since \[ 1 + 30^2 + 1 + 9^2 + 1 + 4^2 = 1 + 900 + 1 + 81 + 1 + 16 = 1000 \]
inputFormat
The input is a single positive integer N read from standard input.
Format:
N
outputFormat
Output 6 integers \(a, b, c, d, e, f\) separated by a single space on one line such that they satisfy
[ a + b^2 + c + d^2 + e + f^2 = N ]
and the constraints \(1 \le a, b, c, d, e, f \le 10^6\).
## sample53
1 5 1 4 1 3