CF1359C Mixing Water
题目描述
有两种无限的水源:
- 温度为 $h$ 的热水;
- 温度为 $c$ 的冷水( $c \lt h$ )。
您要执行以下交替移动的程序:
1. 取**一**杯**热**水,倒入一个无限深的桶中;
2. 取**一**杯**冷**水,倒入无限深的木桶中;
3. 取**一**杯**热**水 $\dots$
4. 依此类推 $\dots$
**注意,一定要从一杯热水开始**。
木桶最初是空的。你必须**至少倒一杯**到桶里。木桶中的水温是倒入的杯子温度的平均值。
您希望水温尽可能接近 $t$ 。因此,如果木桶中的温度是 $t_b$ ,那么 $t_b$ 和 $t$ ( $|t_b - t|$ )的**绝对差**应该尽可能小。
你应该往桶里倒多少杯水,才能使桶里的温度尽可能接近 $t$ ?如果有多个绝对差最小的答案,则打印其中最小的答案。
1. 每个“一杯”的大小相同。
1. 桶一开始时为空。
1. 至少要倒一次水。
1. 第一杯永远是热水。
##### Translated By [Lj_zjl0](https://www.luogu.com.cn/user/311615) & Deepl
输入格式
无
输出格式
无
说明/提示
In the first testcase the temperature after $ 2 $ poured cups: $ 1 $ hot and $ 1 $ cold is exactly $ 20 $ . So that is the closest we can achieve.
In the second testcase the temperature after $ 7 $ poured cups: $ 4 $ hot and $ 3 $ cold is about $ 29.857 $ . Pouring more water won't get us closer to $ t $ than that.
In the third testcase the temperature after $ 1 $ poured cup: $ 1 $ hot is $ 18 $ . That's exactly equal to $ t $ .