Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Unlucky Luke!
Description The great Lucky Luke and his smart horse Jolly Jumper are again caught the four evil Dalton brothers and sent them to the prison. As a reward, the governor of the province in which the Daltons had been caught, gave a collection of gold stones to Luke. At first, Luke became very happy for obtaining such a treasure, but he remembered he had a limited space to carry these stones. In fact, he can just count on the kyack on the back of Jolly which consists of two bags with volume He thought, "At least, I can use as much space as possible in the Jolly's kyack by taking a portion of some of the stones with myself." But Unlucky Luke found that all smiths, instead of their wage for cutting the portion of a stone that he wants, will take the left portion of the stone (for example, if Luke gives the smith one stone and asks him to cut and give him 20% of it, the smith will take the remaining 80% as his wage). What an unfair deal! They know Luke is rich now and will not change their mind! Now, Luke wants to select a portion of each stone in a way that he could place them in two bags in his kyack without exceeding their volume and the selected stones have the maximum total value. Unfortunately, Luke that fires a gun faster than his shadow (see the picture below for the proof of this claim!) can not solve this problem and needs your help! It should be noted that a portion with Input Input begins with a number Output For each test case, your program must output the maximum total value of stones which can be carried by Luke rounded to four digits after the decimal point. Sample Input 1 4 10.0 6 7 8 9 10.0 12.0 14.0 16.0 Sample Output 35.0952 Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator