Week 2 Conditionals Part 2
Bars of Gold
The highwaymen John and Bob robbed the caravan and got as a target three gold bars. They decided to divide the plunder like brothers. John and Bob weighed bars and found that they weigh
x pounds respectively.
Now John and Bob want to divide the bars so that each of them has got an equal amount of gold. They do not want to cut the bars, but nowhere to go. After discussing the situation, they decided that if they can, they will share the plunder as it is, and if not, they will saw only one bar into two parts. To saw two or all three bars of gold they can't.
Help John and Bob to choose the bar to saw into two parts, and the sizes of these parts, so that after cutting they can divide gold equally.
One line contains three integers:
x (1 ≤
10^8, the sum of bar's weights is even).
If it is not possible to saw one bar so that to divide gold equally, print -1.
If John and Bob can divide the gold equally without sawing, print 0.
Otherwise print on the first line number 1, if they need to saw the first bar, 2 if they need to saw the second bar, 3 if they need to saw the third bar. On the second line print two positive integers: the weights of the parts into which the bar must be sawn. These parts in the sum must give the weight of original bar. The total weight of gold is even, so if the bar is cut, its parts have integers weight. If some solutions exist, print any.
2 3 3
2 2 1