Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. import sys
  2. import math
  3.  
  4. # Auto-generated code below aims at helping you parse
  5. # the standard input according to the problem statement.
  6. arr = []
  7. lon = float(raw_input().replace(",","."))
  8. lat = float(raw_input().replace(",","."))
  9. n = int(raw_input())
  10. for i in xrange(n):
  11.     arr.append(raw_input().split(";"))
  12.    
  13. for obj in arr:
  14.     obj[4] = float(obj[4].replace(",","."))
  15.     obj[5] = float(obj[5].replace(",","."))
  16. aarr = []
  17. dm = 99999999
  18. name = ""
  19. for obj in arr:
  20.     x = (obj[4]-lon)*math.cos((lat+obj[5])/2)
  21.     y = (obj[5] - lat)
  22.     d = math.sqrt(x**2+y**2)*6371
  23.     print >> sys.stderr,obj[1]," ",d
  24.     if d < dm:
  25.         name = obj[1]
  26.         dm = d
  27. # Write an action using print
  28. # To debug: print >> sys.stderr, "Debug messages..."
  29.  
  30.  
  31. print name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement