Created
August 29, 2015 17:45
-
-
Save shashisp/7823e36a14ca7a66f575 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m, n = raw_input().split() | |
m = int(m) | |
n = int(n) | |
e_list = [] | |
e_list = raw_input().split() | |
combination = [(e_list[i],e_list[j]) for i in range(len(e_list)) for j in range(i+1, len(e_list))] | |
difference = [] | |
for e in combination: | |
difference.append(abs(int(e[0]) - int(e[1]))) | |
count = 0 | |
for d in difference: | |
if d == n: | |
count+=1 | |
print count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment