You have n buckets arranged in a row, each containing a different amount of water measured in gallons. Your goal is to equalize the water levels across all buckets by pouring water from one bucket to another.
However, there's a catch! Every time you pour k gallons of water from one bucket to another, you lose a certain percentage of that water due to spillage. If the loss percentage is loss, then only k Γ (100 - loss) / 100 gallons actually reach the destination bucket.
Given an array buckets where buckets[i] represents the initial water amount in the i-th bucket, and an integer loss representing the spillage percentage, find the maximum possible water level that can be achieved in each bucket when all buckets have equal amounts.
Note: You can pour any fractional amount of water, and answers within 10-5 of the actual answer will be accepted.
Input & Output
Constraints
- 1 β€ n β€ 103
- 0 β€ buckets[i] β€ 105
- 0 β€ loss < 100
- Answers within 10-5 of the actual answer will be accepted