All submissions for this problem are available.
You are a bird shooting enthusiast. You are standing on position 0 and a flock of birds (assume infinitely many birds) is flying away from you at 1m/s.
The flock of birds is initially at 1m away from you.
Your rating is (P, N) and your time lag is (T, R). This means the following.
If P is your precision rating : At every turn, beginning when the birds are at 1m position, you take a shot at one of the birds in the flock.
Suppose at this turn, if the flock of birds is Xm away from you, then probability that shot is successful is 1 ⁄ XP.
N is your range : You can only shoot at the flock of birds if it is at a distance less than or equal to N.
- T is your reload time : After every shot, you reload your gun, and that takes time T. The next time you shoot, thus the flock of birds is T more meters away than it initially was.
R is your rejoicing time :D : If you are successful in shooting a bird, you rejoice your success and spend an extra amount of time R in reloading
(taking a total of T + R time before the next shot).
Assume that you have infinitely many bullets.
Given N, P, T, and R. Find the expected number of birds you will shoot down!
A single line containing space separated 4 numbers N, P, T, and R, in that order. P is a real number while others are positive integers.
A single line containing the expected number of birds you will shoot down. The output should be correct to within 10^(-6) of the actual answer.
- P is a real number, 1 < P < 100
- 1 ≤ N ≤ 10^18
- 1 ≤ T ≤ 10^5
- 1 ≤ R ≤ 10^5
- Further, ln(N) < 14 (P - 1)
Input: 10 2 3 4 Output: 1.015625
|Tags||admin2, expectation, floating, medium, probability, wpc1, wpc1401|
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions