The Sum Equals the Product |
One day in a supermarket I witnessed the following scene. A young man put 3 items onto the conveyor belt and watched the cashier entering the numbers. He noticed that the cashier did not add the 3 prices but multiplied them! He of course was not willing to pay the final outcome which appeared on the electronic display and asked for the manager to come. In the mean time the young man took a piece of paper, wrote down the 3 prices and added them up. For some strange reason the result was precisely the same. He paid the sum (which was also the product) and left. This equality only appears with very special triplets of numbers. I remember the sum (or product) beeing within a certain range (between $ 5.70 and $ 6.10). But, what were the 3 prices?
sum = a + b + c = a*b*c
Where a, b and c are the 3 prices in ascending order. The output lines shall start with the
smallest sum (or product) within the range and also be in ascending order. In the special case of
multiple solutions for one and the same sum (or product), the first line shall be the one
containing the smallest price (a).
All numbers (sum, a, b, c) are printed with 2 digits after the decimal point.
5.70 6.10
5.70 = 1.25 + 1.60 + 2.85 = 1.25 * 1.60 * 2.85 5.85 = 1.00 + 2.25 + 2.60 = 1.00 * 2.25 * 2.60 5.88 = 0.98 + 2.40 + 2.50 = 0.98 * 2.40 * 2.50 6.00 = 1.00 + 2.00 + 3.00 = 1.00 * 2.00 * 3.00