ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > IMPC16 Group Contests > задача:


14. 50862 - Sum of the Pairs

IMPC16 Group Contests

Старт: 16.янв.2016 в 10:00:00
Финиш: 16.янв.2016 в 14:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (4)

Задачи турнира

• 01. 50832 - Rock Paper Scissors Liz...
• 02. 50833 - Min of Odd Positions
• 03. 50834 - The train which leaves ...
• 11. 50859 - Low performance
• 12. 50860 - Number of Student Certi...
• 13. 50861 - The largest Student Group
• 14. 50862 - Sum of the Pairs
• 15. 50863 - Total Access Cost of a BST
• 21. 50873 - Max Frequency
• 22. 50874 - Apartment Building Adm...
• 23. 50875 - Take m-out
• 24. 50876 - He is my cousin
• 25. 50877 - Friendly Queue
• 32. 50926 - School Mail Merge
• 33. 50927 - Health Expenses

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.

Sum of the Pairs

Your math professor is writing a list of unique numbers and is asking you to give him the number of pairs whose sum is equal to X. The professor is very busy now and wants you to do the calculations quickly and to give him the final result.

Question: Given a list of n unique numbers, output the number of pairs whose sum is equal to X.

Input specification:
In the first line you will be given two integers n and X (5 <= n <= 200.000, -100.000 <= X <= 100.000), where n determines the number of integers that the list will contain and X determines the sum which the numbers of each pair should give as their sum when added to each other. In the following line, you will be given n integers (-100.000 <= nr <= 100.000).

Output specification:
Write a single number, the number of pairs whose sum is equal to X.

Sample Input I
5 7
1 2 3 4 5
Sample Input II
10 7
4 6 3 1 7 5 11 -3 2 -1
Sample Output I
2
Sample Output II
3

Explanation 1:
There are two pairs whose sum is equal to 7: (2,5) and (3,4).

Explanation 2:
There are three pairs whose sum is equal to 7: (4,3), (6,1) and (5,2)



Для отправки решений необходимо выполнить вход.

www.contester.ru