AlgoLensArena
ContestlərProblemlərOtaqlar
Vizualizator
← Məsələlər

BAPC22-054.Crashing Competition Computer

Medium · 4 s · 256 MB

  • icpc
  • bapc
  • 2022

You are writing code for a hackathon where you need to decode Binary ALGOL Punch Cards. You have already come up with the optimal solution and only need to type it out. The solution consists of ccc characters, and your typing speed is 111 character per time unit. However, your computer is prone to sudden crashes: after every character you type there is a probability of ppp that your computer crashes and you need to start over again. Recovering after a crash costs rrr time units, and you can then continue typing from the last point where you saved your code.

You can click “Save” at any time (which costs ttt time units) to save your code and to be able to restart from this point after crashes. Clicking “Save” will not cause your computer to crash.

Determine how many (expected) time units you need to complete the code. Note that the code should be saved after typing the last character.

Giriş formatı

The input consists of:

• One line with three integers ccc, ttt, and rrr (1≤c≤20001 \leq c \leq 20001≤c≤2000, 0≤t,r≤1090 \leq t, r \leq 10^90≤t,r≤109), indicating the number of characters, the time cost of clicking “Save”, and the time cost of recovering after a crash.

• One line with a floating-point number ppp (0.001≤p≤0.9990.001\leq p \leq 0.9990.001≤p≤0.999, with at most 101010 digits after the decimal point), the probability that your computer crashes after a character press.

Çıxış formatı

Output the expected number of time units you need to complete the code.

Your answer should have an absolute or relative error of at most 10−610^{-6}10−6.

Qeyd

Source: Benelux Algorithm Programming Contest 2022 · Author: Jorke de Vlas · License: CC BY-SA 4.0 · Original: https://bapc.eu · Statement adapted for AlgoLens and shared under the same license.

Nümunələr

Giriş #1

2 1 5
0.25

Çıxış #1

8.0

Giriş #2

3 5 2
0.5

Çıxış #2

26.0

Giriş #3

10 4 5
0.327

Çıxış #3

68.664967357