Chocolate Day!!!

1

1 votes
Easy
Problem

You have total N numbers of chocolates. The price of the chocolates is stored in an array. Now you need to buy exact two chocolates among N chocolates such that the sum of the prices of two chocolates should be divisible by K. Print the number of ways you can buy two chocolates.

Input:

The first line contains 2 integers, N and K.

The second line contains N space-separated integers.

Output:

Print the number of ways you can buy chocolates so that the spent money is divisible by K.

Constraints:

2 <= N <= 100

1 <= K <= 100

1 <= N[i] <= 100

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Here are the 5 ways you can buy chocolates.

  • (0, 2) -> 1 + 2 = 3
  • (0, 5) -> 1 + 2 = 3
  • (1, 3) -> 3 + 6 = 9
  • (2, 4) -> 2 + 1 = 3
  • (4, 5) -> 1 + 2 = 3
Editor Image

?