Given n, r and K. The task is to find the number of permutations of different things taken at a time such that specific things always occur together.
Input : n = 8, r = 5, k = 2 Output : 960 Input : n = 6, r = 2, k = 2 Output : 2
- A bundle of specific things can be put in r places in (r – k + 1) ways .
- k specific things in the bundle can be arranged themselves into k! ways.
- Now (n – k) things will be arranged in (r – k) places in ways.
Thus, using the fundamental principle of counting, the required number of permutations will be:
Below is the implementation of the above approach:
- Permutations of n things taken all at a time with m things never come together
- Minimum time to reach a point with +t and -t moves at time t
- All permutations of an array using STL in C++
- All reverse permutations of an array using STL in C++
- Problem on permutations and combinations | Set 2
- Number of palindromic permutations | Set 1
- Find the number of good permutations
- Print all permutations of a string in Java
- Check if two Linked Lists are permutations of each other
- Count permutations that are first decreasing then increasing.
- Permutations of string such that no two vowels are adjacent
- Count the number of special permutations
- Generate all cyclic permutations of a number
- Write a program to print all permutations of a given string
- Print all permutations in sorted (lexicographic) order
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.
Improved By : Mithun Kumar