Problem Description
Description
It’s almost the end of the term, and YJJ decided to give everyone some welfare. What is the welfare? It’s a string of numbers!
GG immediately became unhappy: why didn’t YJJ give me one?
YJJ: As long as you tell me the sum of the numbers in this sequence that are divisible by m, I’ll give you the welfare.
GG: (·········).
PS: It looks like GG is already dizzy. Smart ACMer, can you help GG get YJJ’s welfare?
Input
This problem has multiple test cases. First input a t (t<=100), representing t test cases.
For each test case, first input two integers n and m. (1<=n<=100,1<=m<=1000000)
Next are n numbers, representing this sequence of numbers.
Output
For each test case, output one integer on a line, representing the sum of the numbers in this sequence that are divisible by m.
Sample Input
| |
Sample Output
| |
Problem Analysis
The problem is not difficult
but this piece of code seems wrong…
Let’s keep it for now…
| |
=====20160213===written below========
It seems that this problem was redesigned
and rejudged
so it is different from the problem at that time
Therefore the code above is completely different
The code for the new version of this problem should be like this
| |
Problem link: ZZULI 1675 YJJ’s Welfare