GROCERY - Grocery store

A cashier in a grocery store seems to have difficulty in distinguishing the multiplication symbol and the addition symbol. To make things easier for him, you want to buy goods in such a way that the product of their prices is the same as the sum of their prices.

Of course, if you buy only one item, this is always true. With two items and three items, it still seems quite a boring task to you, so now you are interested in finding possible prices of four items such that the sum of the four prices is equal to the product of the four prices. You should consider the prices are in € with two digits after the decimal point. Obviously, each product costs at least one cent.

Input Specification

This problem has no input.

Output Specification

Print all solutions which have a sum of the four items of at most 20.00 €. For each solution, print one line with the prices of the four items in non-decreasing order, with one space character between them. You may print the solutions in any order, but make sure to print each solution only once.

Sample Output

0.50 1.00 2.50 16.00
1.25 1.60 1.75 1.84
1.25 1.40 1.86 2.00
...

Added by:Adrian Kuegel
Date:2007-07-06
Time limit:1s
Source limit:600B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:University of Ulm Local Contest 2007

hide comments
2022-10-17 01:44:58 :D
Do not print trailing spaces after last digit on every line. Print newline after every solution, including the last one. Also keep in mind this is a code golfing problem (600 bytes code limit). Easy to miss.
2011-06-27 09:25:27 Adrian Kuegel
The spoj server is probably slower than your computer. Try to optimize a little bit more.
2011-06-25 11:18:27 Jay Pandya
how can be tle?? on my pc,output is coming in 0.8 s ...please check!!
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.