#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <stack> #include <string> #include <vector> using namespace std; int main(void) { double x0, y0, x1, y1, r; while (cin >> x0 >> y0 >> x1 >> y1 >> r) { double d = sqrt(pow(x1 - x0, 2) + pow(y1 - y0, 2)); if (d == 0) { cout << "重合" << endl; } else if (d > 2 * r) { cout << "相离" << endl; } else if (d == 2 * r) { cout << "相切" << endl; } else { double sita = 2 * acos(d / (2 * r)); double s = r * r * sita - r * r * sin(sita); printf("相交 %.2lf\n", s); } } } |
Double click to view unformatted code.