There is a test of Algorithms. Teacher provides a question bank consisting of N questions and guarantees all the questions in the test will be from this question bank. Due to lack of time and his laziness, Codu could only practice M questions. There are T questions in a question paper selected randomly. Passing criteria is solving at least 1 of the T problems. Codu can't solve the question he didn't practice. What is the probability that Codu will pass the test?
Answers
Answered by
5
Language used: Python 3.0
Program:
import math
n=int(input())
for i in range(n):
N,T,M = map(int,input().split(' '))
probability=(1-(math.factorial(N-M))/(math.factorial(T)*math.factorial(N-M)))
#taking in the values of p,q from probability as of p/q
p,q=probability.as_integer_ratio()
#creating the multiple inverse of q
print(pow(q,1000000007-2,1000000007))
Input:
1
4 2 1
Output:
500000004
Learn more:
1. Hockey Problem
brainly.in/question/12306355
2. Numerical belly problem
brainly.in/question/16880104
Similar questions
Social Sciences,
4 months ago
Psychology,
4 months ago
Hindi,
4 months ago
Math,
9 months ago
Biology,
9 months ago
Sociology,
1 year ago
Science,
1 year ago
Math,
1 year ago