Advertisement
Guest User

Untitled

a guest
Jan 20th, 2022
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 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. d = 0
  7. alldefib = []
  8. lon = input()
  9. lat = input()
  10. n = int(input())
  11. for i in range(n):
  12.     defib = input().split(';')
  13.     alldefib.append(defib)
  14.  
  15. for i in range(len(alldefib)):
  16.     a = (math.sqrt(((((round(float((alldefib[i][4].replace(',','.'))), 6) * math.pi / 180) - (round(float((lon.replace(',','.'))),6) * math.pi / 180)) * math.cos(((round(float((lat.replace(',','.'))),6) * math.pi / 180) + (round(float((alldefib[i][5].replace(',','.'))),6) * math.pi / 180) / 2)))**2) + (((round(float((alldefib[i][5].replace(',','.'))),6) * math.pi / 180) - (round(float((lat.replace(',','.'))),6) * math.pi / 180))**2)) * 6371)
  17.     if d == 0:
  18.         d = a
  19.         location = alldefib[i][1]
  20.     elif a < d:
  21.         d = a
  22.         location = alldefib[i][1]
  23.  
  24. # Write an answer using print
  25. # To debug: print("Debug messages...", file=sys.stderr, flush=True)
  26.  
  27. print(location)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement