Kill the birds - tle

https://hack.codingblocks.com/contests/c/543/747
https://ide.codingblocks.com/s/34586

getting TLE.how to solvethat?

The question link is not opening.
Maybe it is a closed contest?

Which batch are you from??

In your code you have used the pow function.
Try making and using your own fast power function by recursive method. That would help optimize the code.

If that doesn’t help, then please post the complete question statement here
As I am unable to view the question from the link provided by you…

SOLN::
https://ide.codingblocks.com/s/34623
still gives TLE

QUESTION::
Singh got a new video game and he was playing a shooting game. There are two birds to kill in this shooting game. Hitting first bird will provide him X points and hitting second bird will provide him Y points. And there are 0 points if he misses the bird.

Singh has N coins and it takes 1 coin to try a shoot. He needs to score a minimum of W points to win the game.

At each turn, he has two choices. The choices include:-

Hitting first bird with probability P1 percent. However, he might miss it with probability (1-P1) percentage.
Hitting second bird with probability P2 percent. However, he might miss it with probability (1-P2) percentage.

Help Singh in finding the maximal expected probability (as a percentage b/w 0 and 100) of winning the shooting game

Input Format:
First line contains the number of test cases T.
Each test case consists of six space separated integers of the form X Y N W P1 P2 as described in the statement.

Constraints:
1 ≤ T ≤ 10
1 ≤ X,Y ≤ 10
1 ≤ N,W ≤ 10^3
0 ≤ P1,P2 ≤ 100
Output Format:
For each test case, print the result as described above in a separate line.
Note: Choosing to hit any apple is entirely his choice. Both are independent events meaning P1 + P2 may/may not exceed 100.
Output must contain 6 digits after decimal.

Sample Input:
1
2 3 2 5 50 25
Sample Output:
12.500000
Explanation:
Singh is getting 2 points from shooting first bird and 3 points from shooting second Apple.

Singh had 2 chances to shoot and he need to score atleast 5 points so anyhow he need to shoot bird 1 in one shoot and bird 2 in another shoot , if he wants to win.

The maximum probability of winning is 0.5 * 0.25 = 0.125 = 12.5%

its the question from APAT test i tried for practice.I am in cmplt c++ online batch.

@sss
The pow function uses O(logn) complexity. So that wont lead to a TLE.

According to my understanding to the problem,

There are four cases.
bird 1 bird 2
kill kill
kill no
no kill
no no

Calculate the probability of all four cases:

P1P2
P1*(1-P2)
(1-P1)P2
(1-P1)
(1-P2)

Now see which case satisfies the conditions, as out of that, take the maximum probability case.

still unable to solve.can u please provide ur code