QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 256 MB مجموع النقاط: 100

#18053. Barrel

الإحصائيات

往一个桶里倒入一定量的水,然后将若干个不同大小和密度的立方体放入水中。最后,将一个盖子盖在桶上并向下压,直到它接触到桶的边缘。

编写一个程序来计算桶中最终的水位。

可以假设:

  • 水的密度为 $1.0$,
  • 空气的影响可以忽略不计,
  • 立方体完全能放进桶中,
  • 立方体不会旋转,且彼此互不接触。

输入格式

输入的第一行包含三个实数——桶的底面积 $S$ ($0 < S \le 1000$)、桶的高度 $H$ ($0 < H \le 1000$) 以及水的体积 $V$ ($0 < V \le S \cdot H$)。

下一行包含立方体的数量 $N$ ($0 < N \le 1000$)。

接下来的 $N$ 行,每行包含两个实数,描述一个立方体——立方体的边长 $L$ ($0 < L \le 1000$) 和立方体的密度 $D$ ($0 < D \le 10$)。

输出格式

输出仅包含一个实数——最终的水位。输出与正确答案的差值不能超过 $10^{-4}$。

样例

输入样例 1

100 10 500
1
1 0.5

输出样例 1

5.0050

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.