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.
- arr = []
- lon = float(raw_input().replace(",","."))
- lat = float(raw_input().replace(",","."))
- n = int(raw_input())
- for i in xrange(n):
- arr.append(raw_input().split(";"))
- for obj in arr:
- obj[4] = float(obj[4].replace(",","."))
- obj[5] = float(obj[5].replace(",","."))
- aarr = []
- dm = 99999999
- name = ""
- for obj in arr:
- x = (obj[4]-lon)*math.cos((lat+obj[5])/2)
- y = (obj[5] - lat)
- d = math.sqrt(x**2+y**2)*6371
- print >> sys.stderr,obj[1]," ",d
- if d < dm:
- name = obj[1]
- dm = d
- # Write an action using print
- # To debug: print >> sys.stderr, "Debug messages..."
- print name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement