41 lines
980 B
Python
Executable file
41 lines
980 B
Python
Executable file
class Star:
|
|
def __init__(self):
|
|
self.x = None
|
|
self.y = None
|
|
|
|
def dist_sqr(self, star):
|
|
return (self.x - star.x) ** 2 + (self.y - star.y) ** 2
|
|
|
|
def find_constellations(M, S):
|
|
for i in range(len(S)):
|
|
for j in range(i+1, len(S)):
|
|
M[i][j] = Star.dist_sqr(S[i], S[j])
|
|
M[j][i] = M[i][j]
|
|
c = 0
|
|
for i in range(len(S)):
|
|
D = {}
|
|
for j in range(len(S)):
|
|
if i == j:
|
|
continue
|
|
if M[i][j] not in D:
|
|
D[M[i][j]] = 1
|
|
else:
|
|
D[M[i][j]] += 1
|
|
for k in D:
|
|
if D[k] >= 2:
|
|
c += int(D[k] * (D[k] - 1) / 2)
|
|
return c
|
|
|
|
if __name__ == "__main__":
|
|
n = int(input())
|
|
M = [[None] * n] * n
|
|
S = []
|
|
for i in range(n):
|
|
st = input().split()
|
|
star = Star()
|
|
star.x = int(st[0])
|
|
star.y = int(st[1])
|
|
S.append(star)
|
|
print(find_constellations(M, S))
|
|
|
|
|