|
|
back to boardHi to everyone. Why its WA3 import math values = raw_input().split(' ') a = float(values[0]) b = float(values[1]) c = float(values[2]) d = float(values[3]) if (math.fabs(a*b-c*d)<0.001): print "Impossible."
j = 0.0 x = a**2 + b**2 #DC**2(1) y = c**2 + d**2 #DC**2(2) x1 = - 2 * a * b y1 = - 2 * c * d l = math.fabs(x - y) r = math.fabs(x1 - y1) if r == 0: False else: j = l / r #cos res = a**2.0 + b**2.0 - 2.0 * a * b *j #DC**2 res = math.sqrt(res)*1000 #DC print "Distance is %(res)d km." %{"res": res} Edited by author 29.04.2016 15:30 Edited by author 29.04.2016 16:01 |
|
|