Problem Statement | |||||||||||||
In Chemistry, there's a different meaning to the word 'solution' than in programming. When we mix x liters of some substance with (100-x) liters of water, we get 100 liters of x-% solution of that substance. You are given several bottles containing solutions of the same substance. The i-th bottle contains amount[i] liters of percent[i]-% solution. Return the maximal number of liters of need-% solution we can get by pouring together some of these bottles (possibly partially, see example 0). | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | The returned value must have an absolute or relative error less than 1e-9. | ||||||||||||
Constraints | |||||||||||||
- | percent will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of percent will be between 0 and 100, inclusive. | ||||||||||||
- | amount will contain the same number of elements as percent. | ||||||||||||
- | Each element of amount will be between 1 and 1000, inclusive. | ||||||||||||
- | need will be between 0 and 100, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|