# Untitled

Oct 20th, 2020
803
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. class Circle:
2.     def __init__(self, r_i, x_i, y_i, vx_i, vy_i) -> None:
3.         super().__init__()
4.         self.vy = vy_i
5.         self.vx = vx_i
6.         self.y = y_i
7.         self.x = x_i
8.         self.r = r_i
9.
10.     def touches(self, circle):
11.         if ((self.x - circle.x) ** 2 + (self.y - circle.y) ** 2) ** (1 / 2) <= (circle.r + self.r):
12.             return True
13.         return False
14.
15.
16. N, T, dt = map(int, input().split())
17. circles = []
18. for i in range(N):
19.     r_i_inp, x_i_inp, y_i_inp, vx_i_inp, vy_i_inp = map(int, input().split())
20.     circles[i] = Circle(r_i_inp, x_i_inp, y_i_inp, vx_i_inp, vy_i_inp)
21.
22. collisions_number = 0
23. for time in range(0, T + 1, dt):
24.     for i in range(N):
25.         circles[i].x += circles[i].vx
26.         circles[i].y += circles[i].vy
27.
28.     for i in range(N):
29.         for j in range(i + 1, N):
30.             if circles[i].touches(circles[j]):
31.                 collisions_number += 1
32.
RAW Paste Data