#include <map> #include "stdlib.h" #include<stdio.h> #include <algorithm> #include <iostream> #include <cstdio> #include <string> #include <iomanip> #include "math.h" using namespace std; map<char, int> mp; int main() { double x1, y1, x2, y2, r, a; while (cin >> x1 >> y1 >> x2 >> y2 >> r) { a = abs(sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2))); if (x1 == x2 &&y1 == y2)cout << "重合"; else if (a == 2 * r)cout << "相切" ; else if (a > 2 * r)cout << "相离"; else if (a < 2 * r) { cout << "相交 "; double z = acos(a / (2 * r)); double b = 2 * r*r*z - a*r*sin(z); printf("%.2lf", b); } cout << endl; } return 0; } |
Double click to view unformatted code.