시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 359 | 98 | 80 | 29.091% |
The lunch break just started! Your mother gave you one litre of pink lemonade. You do not like pink lemonade and want blue lemonade instead. Fortunately for you the other children in class are willing to trade with you.
Each of them is willing to offer you any quantity of the virtually infinite amount of lemonade they got from their mother, in exchange for their favourite lemonade, according to some exchange rate. The other children are sitting in a long row in the class room and you will walk along the row, passing each child only once. You are not allowed to walk back! Of course, you want to maximise the amount of blue lemonade you end up with. In case you can obtain more than 10 litres of blue lemonade, this is more than you will need, and you will throw away any excess (and keep the 10 litres).
Fortunately, you know in advance what everybody is offering for trade. Your task is to write a program to find the maximum amount of blue lemonade that you can obtain.
The input consists of the following:
All strings are guaranteed to have at most 10 alphanumeric characters.
Output a single line containing a single floating point number M, the maximum amount (in litres) of blue lemonade that you can obtain. In case you could obtain more than 10 litres, M is considered to be 10. You are required to output M with absolute precision 10−6.
3 blue pink 1.0 red pink 1.5 blue red 1.0
1.500000000000000
2 blue red 1.0 red pink 1.5
0.000000000000000
4 orange pink 1.9 yellow orange 1.9 green yellow 1.9 blue green 1.9
10.000000000000000
8 red pink 1.9 orange red 1.9 yellow orange 1.9 green yellow 1.9 indigo green 0.6 violet indigo 0.6 purple violet 0.6 blue purple 0.6
1.688960160000000