Sum | 프로그래밍의 벗 PivotOJ
PivotOJ

Sum

시간 제한: 1000ms메모리 제한: 1024MB출처: EIO 2018-19 prelimBOJ 29940

문제

Consider an NN-element strictly increasing integer sequence AA and an integer SS.

Write a program to count the number of pairs of elements of AA whose sum is SS.

입력

The first line of input contains NN and SS, the length of the sequence and the required sum (1N1000001 \le N \le 100\,000, 0S20000000 \le S \le 2\,000\,000). The following NN lines contain elements of the sequence, one element AiA_i (0Ai10000000 \le A_i \le 1\,000\,000) on each line. The elements are distinct and ordered increasingly.

출력

The only line of output should contain the number of pairs that consist of two distinct elemets of the sequence and sum to SS.

예제

예제 1

입력
5 10
1
3
5
7
9
출력
2
코드를 제출하려면 로그인하세요.