Skip to content

Commit c6c3fce

Browse files
authored
Solution
1 parent 0e6708e commit c6c3fce

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/python3
2+
3+
import math
4+
import os
5+
import random
6+
import re
7+
import sys
8+
9+
# Complete the divisibleSumPairs function below.
10+
def divisibleSumPairs(n, k, ar):
11+
count=0
12+
for i in range(len(ar)):
13+
for j in range(i+1,len(ar)):
14+
if((ar[i]+ar[j])%k==0):
15+
count+=1
16+
return count
17+
18+
19+
if __name__ == '__main__':
20+
fptr = open(os.environ['OUTPUT_PATH'], 'w')
21+
22+
nk = input().split()
23+
24+
n = int(nk[0])
25+
26+
k = int(nk[1])
27+
28+
ar = list(map(int, input().rstrip().split()))
29+
30+
result = divisibleSumPairs(n, k, ar)
31+
32+
fptr.write(str(result) + '\n')
33+
34+
fptr.close()

0 commit comments

Comments
 (0)