시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 271 | 211 | 191 | 78.279% |
Given a sequence of N distinct integer numbers compute the number of pairs that sum to K.
Example:
Given the sequence {1, 2, 3, 4, 5, 6}
Note that we consider that the pairs (1, 6) and (6, 1) are the same.
The first line will contain two integers N and K.
N represents the number of elements in the sequence and K the goal value.
We want to know how many pairs of numbers sum to K.
The second line will contain N integers separated by spaces.
N <= 1000
The numbers in the sequence will be between 1 and 10^6.
An integer, the number of pairs that add K.
6 7 1 3 2 6 5 4
3