Programación manual Dios
¿Importar? Matemáticas
def? getMinus(a,b):
c? =?abs(a?-?b)
¿Si? ¿do? >? 180:
c? =?360?-?c
¿Volver? c
def? getLineLength(a, b):
r? =?6378.137
¿Volver? r? *?math.sqrt(2?*?(1?-?math.cos(2?*?getMinus(a,b)?*?math.pi?/?360)))
def ? getRoundLength(a, b):
r? =?6378.137
¿Volver? r? *?2?*?math.pi? *?getMinus(a,b)? /?360
definición? prueba():
¿Imprimir? "0,?90"
¿Imprimir? getLineLength(0,90),?getRoundLength(0,90)
¿Imprimir? "20.5,?-36.6"
¿Imprimir? getLineLength(20.5,?-36.6),?getRoundLength(20.5,?-36.6)
¿Imprimir? "160,?-170"
¿Imprimir? getLineLength(160,?-170),?getRoundLength(160,?-170)
Si? __nombre__? ==?__main__ ':
¿Valor? =?raw_input("entrada:")
Prueba:
1.? ¿b? =?valor.tira(). Split("?)
¿Imprimir? getLineLength(float(a),? float(b))
¿Imprimir? getRoundLength(float(a),? float(b))
Excepto:
¿Imprimir? Error "Chico, solo puedo usar Python para ayudarte a llegar hasta aquí.
Teorema del coseno: A 2 = B 2+C 2-2 BCCOSA
Según la longitud, los radianes pueden ser calculado, 2PI*diferencia de longitud/360.