Given two integers X and N. The task is to find the total number of ways of selecting X men from a group of N men with or without including a particular man.
Input: N = 3 X = 2
Including a man say M1, the ways can be (M1, M2) and (M1, M3).
Excluding a man say M1, the only way is (M2, M3).
Total ways = 2 + 1 = 3.
Input: N = 5 X = 3
Approach: The total number of ways of choosing X men from N men is NCX
- Including a particluar man: We can choose (X – 1) men from (N – 1) in N – 1CX – 1.
- Excluding a particular man: We can choose X men from (N – 1) in N – 1CX
Below is the implementation of the above approach:
- Ways of selecting men and women from a group to make a team
- Ways to form a group from three groups with given constraints
- Ways of dividing a group into two halves such that two elements are in different groups
- Total ways of choosing X men and Y women from a total of M men and W women
- Total number of ways to place X and Y at n places such that no two X are together
- Ways to form an array having integers in given range such that total sum is divisible by 2
- Predict the winner of the game on the basis of absolute difference of sum by selecting numbers
- Convert Decimal To Hexa-Decimal including negative numbers
- Find sum of N-th group of Natural Numbers
- Nicomachus’s Theorem (Sum of k-th group of odd positive numbers)
- Minimize the sum of the squares of the sum of elements of each group the array is divided into
- Number Theory | Generators of finite cyclic group under addition
- Total no of 1's in numbers
- Count total set bits in all numbers from 1 to n | Set 2
- Count total divisors of A or B in a given range
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.