Computer Science, asked by himabindhupolineni28, 9 months ago

In a crossover fantasy universe, Houin Kyoma is up in a battle against a powerful monster Nomu that can kill him in a single blow. However being a brilliant scientist Kyoma found a way to pause time for exactly M seconds. Each second, Kyoma attacks Nomu with certain power, which will reduce his health points by that exact power. Initially Nomu has H Health Points. Nomu dies when his Health Points reach 0. Normally Kyoma performs Normal Attack with power A. Besides from Kyoma’s brilliance, luck plays a major role in events of this universe. Kyoma’s Luck L is defined as probability of performing a super attack. A super attack increases power of Normal Attack by C. Given this information calculate and print the probability that Kyoma kills Nomu and survives. If Kyoma dies print “RIP”. Constraints 0 < T <= 50 1 <= A, H, C, L1, L2 <= 1000 1 <= M <= 20. L1<=L2 Input Format First line is integer T denoting number of test cases. Each test case consist of single line with space separated numbers A H L1 L2 M C. Where luck L is defined as L1/L2. Other numbers are, as described above.

Answers

Answered by vaibhavi6839
0

Answer:

What you are dealing with here is called binomial distribution. See Binomial Distribution

First, we find monster health points that will remain after M standard attacks. It's 33−3⋅10=3. Clearly Kyoma needs at least 2 successful super attacks to win.

The probability of a successful supper attack is 710. So the probability of two successful super attacks happening is 710⋅710⋅310. However this can happen in three ways (super attack did not happen on the first, second or third second) so we multiply this by 3.

The probability of three successful super attacks happening is 710⋅710⋅710. There is only one way this can happen.

FInally, adding two probabilities together we have

710⋅710⋅910+710⋅710⋅710=98125

Similar questions