SumX#4256

SumX

1 sekunt
128 megabaýt
Örän ýeňil

Consider an array of positive integers a_1, a_2, \ldots, a_n, having values between and 10^6 and an integer . Write a program to determine the number of pairs (a_i, a_j), where 1 \leq i < j \leq n and a_i + a_j = x.

Giriş

The first line contains the integer (1 \leq n \leq 10^5). The second line contains integers - the elements of array that can be repeated. On the third line the integer (1 \leq x \leq 2 \cdot 10^6) is given.

Çykyş

Print the calculated number of pairs.

Mysallar

1-nji mysal

Loading
Loading

2-nji mysal

Loading
Loading