|
|
вернуться в форумwa3 ((( What's wrong??? my code: #include <cstdio> #include <cmath> int main() { int a, b, c, d; scanf("%d %d %d %d", &a, &b, &c, &d);
if (a * b == c * d) { printf("Impossible.\n"); } else { double cos = (a * a * 1.0 + b * b - c * c - d * d) / (2 * a * b - 2 * c * d); double x = a * a * 1.0 + b * b - 2 * a * b * cos;
if (x < 0) printf("Impossible.\n"); else printf("Distance is %d km.\n", (int)(sqrt(x) * 1000)); } } |
|
|