SP28744 KATHTHI2 - Coin Fight
Description
Problem Statement :
Sathish and Kathiresan are known for Coin Fight.
Kathiresan kept on tossing a biased coin repeatedly. Then he decided to solve the following problem.
Find the number of tosses for which the probability of getting exactly K heads is maximum. In case of a tie, return the minimum number of tosses.
In other words, find the minimum n such that Prob (exactly K heads with n tosses) >= Prob (exactly K heads with m tosses) for any m!=n.
**Input :**
The first line consists of an integer t, the number of test cases. For each test case you are given an integer K, the number of heads required and a float p, the probability to get a head when the coin is tossed.
**Output :**
For each test case find the number of tosses required as defined.
**Input Constraints :**
1
Input Format
N/A
Output Format
N/A