본문 바로가기

HackerRank/Algorithms

Divisible Sum Pairs

You are given an array of  integers, , and a positive integer, . Find and print the number of  pairs where  and  +  is divisible by .

Input Format

The first line contains  space-separated integers,  and 
The second line contains  space-separated integers describing the values of .

Constraints

Output Format

Print the number of  pairs where  and  +  is evenly divisible by .

Sample Input

6 3
1 3 2 6 1 2

Sample Output

 5

Explanation

Here are the  valid pairs when :





'HackerRank > Algorithms' 카테고리의 다른 글

Sock Merchant  (0) 2018.07.09
Bon Appetit  (0) 2018.07.09
Day of the Programmer  (2) 2018.07.09
Migratory Birds  (0) 2018.07.06
Birthday Chocolate  (1) 2018.07.05