diff_months: 16

Permutation Coefficient Assignment

Flat 50% Off Order New Solution
Added on: 2023-02-22 06:22:56
Order Code:
Question Task Id: 0

You are given two numbers ‘N’ and ‘K’. Your task is to find P(N, K). P(N, K) is the permutation coefficient given as P(N, K) = N! / (N - K)! where X! Is the product of first X natural number. Since this value may be large only find it modulo 10^9 + 7.

Input Format:

The first line of input contains an integer ‘T’ denoting the number of test cases. The next ‘T’ lines represent the ‘T’ test cases. The first and only line of each test case contains two integers ‘N’ and ‘K’.

Output Format:

For each test case, print a single line containing a single integer denoting the answer for that test case modulo 10^9 + 7. Print the output of each test case in a separate line.


You do not need to print anything, it has already been taken care of. Just implement the given function.


1 <= ’T’ <= 50 1 <= ’N’ <= 10000 0 <= ’K’ <= ’N’ Time Limit: 1 sec

  • Uploaded By : Katthy Wills
  • Posted on : February 22nd, 2023
  • Downloads : 0
  • Views : 306

Order New Solution

Can't find what you're looking for?

Whatsapp Tap to ChatGet instant assistance

Choose a Plan


80 USD
  • All in Gold, plus:
  • 30-minute live one-to-one session with an expert
    • Understanding Marking Rubric
    • Understanding task requirements
    • Structuring & Formatting
    • Referencing & Citing


30 50 USD
  • Get the Full Used Solution
    (Solution is already submitted and 100% plagiarised.
    Can only be used for reference purposes)
Save 33%


20 USD
  • Journals
  • Peer-Reviewed Articles
  • Books
  • Various other Data Sources – ProQuest, Informit, Scopus, Academic Search Complete, EBSCO, Exerpta Medica Database, and more