Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import sqrt
- def get_argument(value1, value2):
- return (value1 - value2) ** 2
- def get_s(x1, y1, x2, y2):
- return sqrt(get_argument(y1, y2) + get_argument(x1, x2)) * centersDistance
- def get_shadow(q, s):
- return (lightHeight / (lightHeight - d * q)) * s - s
- def check_line(x1, y1, x2, y2):
- if (lightX - x1) * (y2 - y1) == (x2 - x1) * (lightY - y1):
- return True
- return False
- lightHeight = 50
- d = 4
- lightX = 4
- lightY = 4
- centersDistance = 5
- res = 0
- inputData = []
- n = int(input())
- for i in range(0, n):
- itemData = eval(input())
- inputData.append(itemData)
- for item in inputData:
- itemX = item[0]
- itemY = item[1]
- itemS = get_s(lightX, lightY, itemX, itemY) + d / 2
- itemShadow = get_shadow(item[2], itemS)
- for potential in inputData:
- if item != potential:
- pX = potential[0]
- pY = potential[1]
- if check_line(itemX, itemY, pX, pY):
- pS = get_s(lightX, lightY, pX, pY) + d / 2
- if itemS < pS:
- if itemShadow > get_s(itemX, itemY, pX, pY) - d:
- res += 1
- print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement