probability question

It’s the rainy season again, and the city experiences frequent showers throughout the day.

The weather report says that there is a P probability of rainfalls today. Raj has to step out for a meeting at the office, and would like to know the probability that it rains during the time he is on the way.

Input:

The first line of input contains the number of test cases, T. Each of the following T lines contain two numbers, P and time. P denotes the probability that it will rain today and time is the time (in minutes), it will take for Raj to reach his office.

Output:

Output should have T lines each containing answer to corresponding test case. Please round the answer to 4 decimal places.

Constraints:

1<= T<= 100
0 <= P<= 0.5
10 <= time <= 720
time is a perfect divisor of 1440.

Sample Input (Plaintext Link)

2
0 10
.5 720

Sample Output (Plaintext Link)

0.0000
0.2929

@strider29

This is a simple probability question. We need to find the probability that it rains during the time Raj is on the way.

So probability that it won’t rain today will be (1-p)

Probability that it won’t rain when Raj is on the way = pow((1-p), time/1440) why time/1440 because probability is given for 24 hours.

Finally, probability that it will rain sometime when Raj is on his way = 1 - pow((1-p), time/1440).

I hope this helps. :slight_smile:

why have you calculated probability of not raining first,and then calculated the required probability?
why doesnt pow(p,time/1440) give answer?

I know this is the challenge from HackerEarth. You should try to solve this problem, then only can become expert.

//