2353: Serial Numbers

内存限制:128 MB 时间限制:2.000 S
评测方式:文本比较 命题人:
提交:88 解决:21

题目描述

 The  great  guitar  player  Bernhard-Anton  Peter  Cobain  is  playing  with  his  band  the  Awesome 
Crying  Metalheads  in  the  wonderful  city  of  Leiden. The  show  goes  well  and  Bernhard-Anton  is 
very happy, but after the show he has a big problem:  his guitars are mixed up with all the guitars 
of the other guitar players, and Bernhard-Anton does not remember which guitars were his. 
    Fortunately, every guitar has a unique serial number which is an integer between 1 and 100, 000. 
The only thing that Bernhard-Anton remembers is that the sum of all the serial numbers of his 
guitars is a multiple of M .  Given all serial numbers and the number M , calculate the maximum 
number of guitars that could have been Bernhard-Anton’s. 

输入

 The first line of the input contains a single number:  the number of test cases to follow.  Each test 
case has the following format: 
    •  One  line  with  two  integers N and  M ,  satisfying  1 ≤ N  ≤ 500 and  1 ≤ M ≤ 100, 000:      the 
      total number of guitars and the number M . 
    •  One line with N different integers S1 ,S2 ... SN      satisfying 0 ≤ Si   ≤ 100, 000:  the serial numbers  of the guitars. 
    Integers  on  the  same  line  are  separated  by  single  spaces,  and  there  will  always  be  at  least  one 

输出

For every test case in the input, the output should contain a single number, on a single line:  the maximum number of guitars such that the sum of their serial numbers is a multiple of M . 

样例输入 复制

2
3 5
1 8 6 
6 9 
8 6 4 1 2 3

样例输出 复制

3
5

来源/分类