QOJ.ac

QOJ

时间限制: 1 s 内存限制: 512 MB 总分: 100

#10440. 弯曲的小瓶子

统计

在华沙骑自行车时,Jill 偶然发现了一家出售有趣玻璃瓶的商店。她认为利用这些瓶子来测量液体可能是一个有趣的项目,但这需要给瓶子刻上刻度以指示不同的体积。这些体积刻度应该放在哪里呢?

Jill 将这个问题形式化如下:假设一个瓶子是由多项式 $P$ 在 $x = x_{\text{low}}$ 和 $x = x_{\text{high}}$ 之间的图形绕 $x$ 轴旋转而成的。因此,$x$ 轴与穿过瓶子中心的一条垂直线重合。瓶底由 $x = x_{\text{low}}$ 处的一个实心圆形区域形成,瓶顶在 $x = x_{\text{high}}$ 处保持开口。

第一个样例输入表示一个由简单多项式 $4 - 0.25x$ 形成的瓶子,其中 $x_{\text{low}} = 0$,$x_{\text{high}} = 12$。该瓶子的底部是一个半径为 4 的圆,顶部的开口是一个半径为 1 的圆。这个瓶子的高度为 12。体积刻度的增量为 25。

给定多项式 $P$、$x_{\text{low}}$、$x_{\text{high}}$ 以及瓶子上连续刻度之间的体积增量,计算从 $x_{\text{low}}$ 开始向上,各连续体积增量处刻度距离瓶底的高度。刻度不能超过瓶顶,且最多标记前 8 个增量。假设 $P$ 的值在 $x_{\text{low}}$ 和 $x_{\text{high}}$ 之间始终大于零。

输入格式

每个测试用例包含三行瓶子数据:

  • 第 1 行:$n$,多项式的次数(满足 $0 \le n \le 10$ 的整数)。
  • 第 2 行:$a_0, a_1, \dots, a_n$,定义瓶子形状的多项式 $P$ 的实数系数,其中 $a_0$ 是常数项,$a_1$ 是 $x^1$ 的系数,以此类推,$a_n$ 是 $x^n$ 的系数。对于每个 $i$,$-100 \le a_i \le 100$ 且 $a_n \neq 0$。
  • 第 3 行:
    • $x_{\text{low}}$ 和 $x_{\text{high}}$,瓶子的实数边界($-100 \le x_{\text{low}} < x_{\text{high}} \le 100$ 且 $x_{\text{high}} - x_{\text{low}} > 0.1$)。
    • $inc$,一个整数,表示瓶子上每个连续刻度前的体积增量($1 \le inc \le 500$)。

输出格式

对于每个测试用例,在第一行显示用例编号和满瓶的体积。在第二行,显示从瓶底向上测量体积刻度的不超过 8 个连续距离的递增序列。所有体积和高度刻度应精确到小数点后两位。如果瓶子的体积不足以容纳至少一个刻度,则显示短语 insufficient volume。没有任何测试用例会导致刻度距离瓶顶小于 0.01。

瓶子的体积不会超过 1000。瓶子上所有四舍五入后的刻度距离至少相差 0.05。

样例

输入 1

1
4.0 -0.25
0.0 12.0 25
1
4.0 -0.25
0.0 12.0 300
0
1.7841241161782
5.0 10.0 20
0
1.0
0.0 10.0 10

输出 1

Case 1: 263.89
0.51 1.06 1.66 2.31 3.02 3.83 4.75 5.87
Case 2: 263.89
insufficient volume
Case 3: 50.00
2.00 4.00
Case 4: 31.42
3.18 6.37 9.55

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.