Problem of the day
Input: ‘N’ = 2, ‘P' = 30, ‘X’ = 29
Output: 1
In this case,
The probability to reach point ‘2(=N)’ while wearing the magic boots is
‘P/100’ = 30/100 = 0.30 i.e. 0.30 > (‘X/100’ = 29/100 = 0.29). Hence the output will be ‘1’.
The first line will contain the integer ‘T’, the number of test cases.
Each test case consists of one line.
The first line of input contains three integers, ‘N’, ‘P’, and ‘X’ separated by spaces.
For each test case, print ‘1’ or ‘0’ depending on the above-mentioned conditions.
You don't need to print anything. It has already been taken care of. Just implement the given function.
1 <= ‘T’ <= 10
1 <= ‘N’ <= 10^5
1 <= ‘P’ <= 100
1 <= ‘X’ <= 100
It is guaranteed that sum of ‘N’ over all test cases is <= 10^5
Time Limit: 1 sec
2
3 17 12
4 16 10
1
0
For the first test case, the probability of reaching point ‘3(=N)’ by wearing magic boots is ‘(100-P)/100’ = 83/100 = 0.83, which is greater than ‘X/100’ = 12/100 = 0.12.
Hence, the output will be: 1
For the second test case, the probability of reaching point ‘4(=N)’ by wearing magic boots and first getting teleported to point ‘2’ with a probability ‘P/100’ and then again getting teleported to point ‘4’ with a probability ‘P/100’ i.e. overall probability is ‘(P/100)*(P/100)’ = (16/100)*(16/100) = 256/10000 = 0.0256, which is less than ‘X/100’ = 10/100 = 0.10.
Hence, the output will be: 0
2
5 20 31
10 40 36
1
0