[Solution] Sample Problem KickStart Solution - Kick Start 2022
You have gathered bags of candy and you want to distribute the candy amongst kids. The -th bag contains pieces of candy. You want to make sure that every kid get the same amount of candy and that the number of pieces of candy they receive is the greatest possible. You can open each bag and mix all pieces of candy before distributing them to the kids.
How many pieces of candy will remain after you share the candy amongst kids, based on the rules described above?
Input
The first line of the input gives the number of test cases, . test cases follow.
Each test case consists of two lines. The first line of each test case contains two integers: integer , the number of candy bags, and , the number of kids.
The next line contains non-negative integers representing array , where the -th integer represents the number of candies in the -th bag.
Output
For each test case, output one line containing Case #x: y
, where x
is the test case number (starting from ) and y
is the number of candies that will remain if you divide candies between kids according to the rules described above.
Limits
Time limit: 60 seconds.
Memory limit: 1 GB.
Test Set 1
.
.
.
, for all from to .
No comments:
Post a Comment