#C11778. Distinct Triple Sum
Distinct Triple Sum
Distinct Triple Sum
You are given a positive integer \(n\). Your task is to determine if \(n\) can be expressed as the sum of three distinct positive integers. If \(n < 6\), it is impossible to express \(n\) as such a sum, so output -1 -1 -1
. Otherwise, output the three integers 1
, 2
, and n - 3
separated by spaces.
Note: Although the problem statement mentions maximizing the product of the triplet, the intended solution is to output the fixed triple (1, 2, n-3)
for \(n \geq 6\), as verified by the test cases.
Examples:
- Input:
10
→ Output:1 2 7
- Input:
15
→ Output:1 2 12
- Input:
3
→ Output:-1 -1 -1
inputFormat
The input consists of a single integer \(n\) given via standard input (stdin).
\(n\) is guaranteed to be a positive integer.
outputFormat
If \(n < 6\), print -1 -1 -1
.
Otherwise, print three distinct positive integers 1
, 2
, and n-3
separated by spaces on a single line, using standard output (stdout).
3
-1 -1 -1