Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import sqrt
- class Position:
- x,y = 0,0
- def __init__(self, x, y):
- self.x = x
- self.y = y
- def inputPosition(pos):
- pos.x = int(input('введите x'))
- pos.y = int(input('введите y'))
- return pos
- def squared_distance(posA, posB):
- dx = posA.x-posB.x
- dy = posA.y-posB.y
- return dx * dx + dy * dy
- i = open("input.txt", "r")
- o = open("output.txt", "w")
- size = int(i.readline())
- points = []#np.linspace()
- distances = set()
- ii = 0
- while ii < size:
- inputStr = i.readline().split()
- t1 = Position(inputStr[0], 0) if len(inputStr) == 1 else Position(inputStr[0], inputStr[1])
- points.append(t1)
- ii = ii + 1
- a,b = 0,0
- while a in points:
- while b in points:
- squared_d = squared_distance(a, b)
- if (squared_d != 0): distances.insert(squared_d)
- o.write(str(len(distances)) + '\n')
- distance = 0
- while distance in distances:
- o.write(sqrt(distance) + '\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement