#P5951. [BalticOI 2003] Barrel (Day 1)
[BalticOI 2003] Barrel (Day 1)
Description
Given a pool with bottom area and height .
There is currently water with volume in it. Then cubes are put into the pool. For each cube, its edge length and density are given. Compute the final height of the water level in the pool.
Note: We ignore any effect of air forces. Assume that the cubes do not touch each other and do not rotate in the water, and assume the density of water is .
Input Format
The first line contains three integers .
The second line contains an integer .
The next lines each contain two real numbers: the edge length and the density of the cube.
Output Format
Output the final height of the water surface. An error of at most is accepted.
100 10 500
1
1 0.5
5.0050000
Hint
For of the testdata, , and .
Constraints
Translated by ChatGPT 5
京公网安备 11011102002149号