Help her, track down the number of ways of choosing k bloggers with the goal that the absolute number of their devotees is greatest conceivable. Two different ways are considered unique in case there is no less than one blogger in the primary manner, which isn't in the subsequent manner. Masha accepts that all bloggers have various adherents (that is, there is no devotee who might follow two distinct bloggers).

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Correct answer will be upvoted else downvoted. Computer science.

 

 Help her, track down the number of ways of choosing k bloggers with the goal that the absolute number of their devotees is greatest conceivable. Two different ways are considered unique in case there is no less than one blogger in the primary manner, which isn't in the subsequent manner. Masha accepts that all bloggers have various adherents (that is, there is no devotee who might follow two distinct bloggers). 

 

For instance, assuming n=4, k=3, a=[1,3,1,2], Masha has two different ways to choose 3 bloggers with the greatest all out number of supporters: 

 

finish up agreements with bloggers with numbers 1, 2 and 4. For this situation, the number of devotees will be equivalent to a1+a2+a4=6. 

 

finish up agreements with bloggers with numbers 2, 3 and 4. For this situation, the number of adherents will be equivalent to a2+a3+a4=6. 

 

Since the appropriate response can be very huge, output it modulo 109+7. 

 

Input 

 

The main line contains one integer t (1≤t≤1000) — the number of experiments. Then, at that point, t experiments follow. 

 

The primary line of each experiment contains two integers n and k (1≤k≤n≤1000) — the number of bloggers and the number of them you can sign an agreement with. 

 

The second line of each experiment contains n integers a1,a2,… an (1≤ai≤n) — the number of devotees of every blogger. 

 

It is ensured that the amount of n over all experiments doesn't surpass 1000. 

 

Output 

 

For each experiment, on a different line output one integer — the number of ways of choosing k bloggers with the goal that the all out number of their devotees is greatest conceivable

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Intelligent Machines
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education