You have gathered NN bags of candy and you want to distribute the candy amongst MM kids. The ii-th bag contains CiCi 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?
The first line of the input gives the number of test cases, TT. TT test cases follow.
Each test case consists of two lines. The first line of each test case contains two integers: integer NN, the number of candy bags, and MM, the number of kids.
The next line contains NN non-negative integers C1,C2,…,CNC1,C2,…,CN representing array CC, where the ii-th integer represents the number of candies in the ii-th bag.
For each test case, output one line containing Case #x: y
, where x
is the test case number (starting from 11) and y
is the number of candies that will remain if you divide candies between kids according to the rules described above.
2 7 3 1 2 3 4 5 6 7 5 10 7 7 7 7 7
Case #1: 1 Case #2: 5
ID | User | Problem | Subject | Hit | Post Date |
沒有發現任何「解題報告」 |