Given three integers N, M, X. The task is to find the probability of distributing M items among X bags such that first bag contains N items
Input : M = 7, X =3, N = 3
Output : 0.2
The Number of ways to keep 7 items in 3 bags is .
The Number of ways to keep 4 items in 2 bags is . As the first bag contains 3 items.
The probability is /
Input : M = 9, X = 3, N = 4
Output : 0.142857
In general, the Number of ways to place N items in K bags is .
- The Number of ways to keep M items in X bags is .
- The Number of ways to keep (M-N) items in (X-1) bags is . As the first bag contains N items.
- The probability is /.
Below is the implementation of the above approach:
- Distributing M items in a circle of size N starting from K-th position
- Program to find the profit or loss when CP of N items is equal to SP of M items
- Ways to place 4 items in n^2 positions such that no row/column contains more than one
- Maximum items that can be bought with the given type of coins
- Count ways to distribute m items among n people
- Calculate the loss incurred in selling the given items at discounted price
- Find the distance covered to collect items at equal distances
- Loss when two items are sold at same price and same percentage profit/loss
- Number of ways of distributing N identical objects in R distinct groups
- Number of ways of distributing N identical objects in R distinct groups with no groups empty
- Probability of rain on N+1th day
- Aptitude | Probability | Question 5
- Aptitude | Probability | Question 6
- Aptitude | Probability | Question 7
- Aptitude | Probability | Question 8
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.