Given a set of distinct integers, print the size of a maximal subset of where the sum of any numbers in is not evenly divisible by .
Input Format
The first line contains space-separated integers, and , the number of values in and the non factor.
The second line contains space-separated integers describing , the unique values of the set.
Constraints
- All of the given numbers are distinct.
Output Format
Print the size of the largest possible subset ().
Sample Input
4 3
1 7 2 4
Sample Output
3
Explanation
The sums of all permutations of two elements from are:
1 + 7 = 8
1 + 2 = 3
1 + 4 = 5
7 + 2 = 9
7 + 4 = 11
2 + 4 = 6
We see that only will not ever sum to a multiple of .
이 문제는 위에 설명된 예제로는 도저히 이해가 되지 않는다. 각 엘리먼트의 합이 k로 나눠지지 않는 서브셋 엘리먼트의 갯수를 구하는 것으로 이해가 되는데, 실제 풀이는 전혀 다르다. 문제를 잘못 이해한것 같은데, 무슨 문제인지 도저히 모르겠다.
그래서 이 문제의 풀이를 구글링해봤는데......풀이를 봐도 이 문제의 뜻을 모르겠다. 무엇을 구하라는 것이지 누가 좀 설명좀 해줬으면 좋겠다. ㅠㅠ
'HackerRank > Algorithms' 카테고리의 다른 글
Jumping on the Clouds (0) | 2018.07.19 |
---|---|
Repeated String (0) | 2018.07.19 |
Cut the sticks (0) | 2018.07.18 |
Library Fine (0) | 2018.07.18 |
Sherlock and Squares (0) | 2018.07.18 |