1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <algorithm> 5 using namespace std; 6 const double eps=1e-8; 7 8 int main() 9 { 10 double a,b,c,d; 11 scanf("%lf%lf%lf%lf",&a,&b,&c,&d); 12 a*=1000.0; b*=1000.0; c*=1000.0; d*=1000.0; 13 if(fabs(c*d-a*b)<eps) 14 { 15 printf("Impossible. "); 16 } 17 else 18 { 19 printf("Distance is %.0lf km. ",sqrt((c*d*(a*a+b*b)-a*b*(c*c+d*d))/(c*d-a*b))); 20 } 21 return 0; 22 }