Chhota Bheem and the Game of Anagrams
All submissions for this problem are available.
Its a fine Sunday in Dholakpur and our friends Bheem, Chhutki, Jaggu and Raju are playing tug of wars with Kalia and his team. Meanwhile their play they got tired and hence needed a break, Bheem got hungry and we all know what he wants.... Yes you guessed it right, his all time favourite laddus. So, Chhutki offered him laddus, meanwhile Kalia noticed that the laddus where not spherical as they used to be but this time they were in the form of English alphabets. Kalia as we know is cunning got some idea to have those laddus from Bheem, and hence challenged Bheem for a game called “Game of Anagrams”.
The challenge given to Bheem was to find all the different anagrams of the given laddus which we know are in the shape of English alphabets (A-Z and a-z) that can be generated with the help of the laddus taken k at a time. Assume all the laddus are of different shapes, help Bheem to win the Game of Anagrams.
- The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
- Next T lines contains 2 space-separated integers N and k where N denotes the number of laddus given by Kalia to Bheem in a challenge and k denotes the number of laddus to be taken at a time for generating anagrams.
- For each test case, output a single line containing number of anagrams formed by taking k letters at a time.
- Since the number can be very large print your answer modulo (10^9+7)
- 1 ≤ T ≤ 50
- 1 ≤ N ≤ 52
- 1 ≤ k ≤ N
Input: 2 7 5 5 1 Output: 2520 5
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA|
Fetching successful submissions