Working solution for N

This commit is contained in:
Claudio Maggioni 2019-05-07 12:11:11 +02:00
parent fdfa9ef95d
commit c756015d45

View file

@ -6,11 +6,25 @@ class Star:
def dist_sqr(self, star): def dist_sqr(self, star):
return (self.x - star.x) ** 2 + (self.y - star.y) ** 2 return (self.x - star.x) ** 2 + (self.y - star.y) ** 2
def __repr__(self):
return str(self)
def __str__(self):
return "(" + str(self.x) + "," + str(self.y) + ")"
def print_M(M):
for i in range(len(M)):
print(M[i])
print()
def find_constellations(M, S): def find_constellations(M, S):
for i in range(len(S)): for i in range(len(S)):
for j in range(i+1, len(S)): for j in range(i+1, len(S)):
M[i][j] = Star.dist_sqr(S[i], S[j]) M[i][j] = Star.dist_sqr(S[i], S[j])
M[j][i] = M[i][j] M[j][i] = M[i][j]
#print(str(S[i]) + " - " + str(S[j]) + ": " + str(M[i][j]))
#print_M(M)
#print(S)
c = 0 c = 0
for i in range(len(S)): for i in range(len(S)):
D = {} D = {}
@ -28,7 +42,9 @@ def find_constellations(M, S):
if __name__ == "__main__": if __name__ == "__main__":
n = int(input()) n = int(input())
M = [[None] * n] * n M = []
for i in range(n):
M.append([None] * n)
S = [] S = []
for i in range(n): for i in range(n):
st = input().split() st = input().split()