Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import math
- # Auto-generated code below aims at helping you parse
- # the standard input according to the problem statement.
- _id = []
- _lon = {}
- _lat = {}
- _adress = {}
- def d(a,b):
- x = (_lon[b]-_lon[a])*math.cos((_lat[a]+_lat[b])/2)
- y = _lat[b]-_lat[a]
- return math.sqrt(math.pow(x,2)+math.pow(y,2))*6371
- lon = input()
- lat = input()
- n = int(input())
- _lon[0] = math.radians(float(lon.replace(",",".")))
- _lat[0] = math.radians(float(lat.replace(",",".")))
- for i in range(n):
- defib = input()
- #print(defib.split(";"), file=sys.stderr)
- _d = defib.split(";")
- id = int(_d[0])
- _id.append(id)
- _adress[id] = _d[1]
- _lon[id] = math.radians(float(_d[4].replace(",",".")))
- _lat[id] = math.radians(float(_d[5].replace(",",".")))
- mem = 1
- for id in _id:
- if(d(0, id) < d(0, mem)):
- mem = id
- # Write an action using print
- # To debug: print("Debug messages...", file=sys.stderr)
- print(_adress[mem])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement