Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.36 KB | None | 0 0
  1. from decimal import Decimal
  2. from math import sqrt
  3. q = int(input())
  4. okr = list()
  5. cil = list()
  6. for i in range(q):
  7.     a = list(eval(input()))
  8.     a[0],a[1],a[2] = a[0]-4,a[1]-4,a[2]*4
  9.     a = list(map(Decimal,a))
  10.     cil.append(a)#1=5
  11.     r = Decimal(2*(Decimal(50)/Decimal((50-a[2]))))
  12.     d = Decimal(sqrt(a[0]**2 + a[1]**2))  
  13.     y = Decimal(d * (Decimal(a[2])/Decimal(50-a[2])))
  14.     try:
  15.         k =  Decimal(abs(a[1]/a[0]))
  16.         x1 = Decimal(sqrt(y**2/(k**2+1)))
  17.         y1 = k*x1
  18.     except:
  19.         y1 = y
  20.         x1 = 0
  21.     if a[0]==0 and a[1] == 0:
  22.         okr.append([(abs(a[0]) +abs(x1))*a[0]/(abs(a[0]+1)),(abs(a[1]) +abs(y1))*a[1]/(abs(a[1]+1)),r,a[0],a[1]])
  23.     elif a[0] == 0:
  24.         okr.append([(abs(a[0]) +abs(x1))*a[0]/(abs(a[0]+1)),(abs(a[1]) +abs(y1))*a[1]/(abs(a[1])),r,a[0],a[1]])
  25.     elif a[1] == 0:
  26.         okr.append([(abs(a[0]) +abs(x1))*a[0]/(abs(a[0])),(abs(a[1]) +abs(y1))*a[1]/(abs(a[1]+1)),r,a[0],a[1]])
  27.     else:
  28.         okr.append([(abs(a[0]) +abs(x1))*a[0]/(abs(a[0])),(abs(a[1]) +abs(y1))*a[1]/(abs(a[1])),r,a[0],a[1]])
  29. res = 0
  30. for i in range(q):
  31.     for c in range(q):
  32.         if okr[i][3] == cil[c][0] and okr[i][4] == cil[c][1]:
  33.             continue
  34.         d = sqrt((okr[i][0] - cil[c][0])**2 + (okr[i][1] - cil[c][1])**2)
  35.         if d*5<= okr[i][2] + 2:
  36.             pass
  37.         print(d*5, okr[i][2] + 2)
  38. print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement