Skip to content

Instantly share code, notes, and snippets.

@rorhug
Created February 21, 2014 23:27
Show Gist options
  • Save rorhug/9145824 to your computer and use it in GitHub Desktop.
Save rorhug/9145824 to your computer and use it in GitHub Desktop.
aipo final 2013 q3
n = int(raw_input())
a = [ int(raw_input()) for x in range(n) ]
average_count = 0
for (i, el) in enumerate(a):
a.pop(i) # remove that element
for to_avg_with in a:
avg = (el + to_avg_with) / 2
if avg in a:
average_count += 1
print(average_count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment