QOJ.ac

QOJ

Límite de tiempo: 1.0 s Límite de memoria: 256 MB Puntuación total: 100 Hackeable ✓

#10844. 提马奥斯

Estadísticas

蒙德城的炼金术士学徒蒂玛乌斯受其导师阿贝多的委托,需要合成一种特定的炼金产品:甜甜花酿。然而,由于技术有限,蒂玛乌斯每次合成只能消耗 $B$ 朵甜甜花来制作一朵甜甜花酿。因此,他寻求了两位助手的帮助:砂糖和莫娜。

砂糖擅长提高产量,在单次合成中,她有 $P\%$ 的概率产出双倍的成果,即消耗 $B$ 朵甜甜花合成出两朵甜甜花酿。另一方面,莫娜擅长资源节约,在单次合成中,她有 $Q\%$ 的概率回收一朵甜甜花,即消耗 $B$ 朵甜甜花合成出一朵甜甜花酿,并同时回收一朵甜甜花。然而,蒂玛乌斯在每次合成时只能选择其中一位助手。

蒂玛乌斯最初拥有 $A$ 朵甜甜花,他的目标是最大化他所能合成的甜甜花酿的期望总数。因此,他必须在每次合成时最优地选择砂糖或莫娜。请计算他所能合成的甜甜花酿的最大期望数量。

输入格式

一行包含四个整数 $A, B, P, Q$ ($1 \le B \le A \le 10^6$, $0 \le P, Q < 100$),分别代表甜甜花的总数、合成一朵甜甜花酿所需的甜甜花数量、产出双倍成果的概率以及回收材料的概率。

输出格式

输出一个浮点数,代表他所能合成的甜甜花酿的最大期望数量。如果你的答案与标准答案之间的绝对误差或相对误差不超过 $10^{-9}$,则视为正确。

样例

输入 1

4 2 10 25

输出 1

2.200000000000000

输入 2

4 2 10 90

输出 2

2.901000000000000

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.