-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathasteroid.py
More file actions
25 lines (23 loc) · 759 Bytes
/
Copy pathasteroid.py
File metadata and controls
25 lines (23 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import sys
import math
def distance (x,y):
return(math.sqrt(x*x + y*y))
cases = int(sys.stdin.readline().rstrip())
# for i in range(cases):
# input = sys.stdin.readline().rstrip()
# seperate_numbers=input.split(" ")
for i in range(cases):
asteroid_list = []
distance_list = []
A = int(sys.stdin.readline().rstrip())
for x in range(A):
asteroid = (sys.stdin.readline().rstrip())
coordinates = asteroid.split(" ")
X = float(coordinates[0])
Y = float(coordinates[1])
X2 = pow(X,2)
Y2 = pow(Y,2)
d = math.sqrt(X2 + Y2)
asteroid_list.append(asteroid)
distance_list.append(d)
print(f'asteroid: {asteroid_list[x]} --- distance {distance_list[x]}')