#include <iostream> #include <cstdio> #include <iomanip> #include <cmath> using namespace std; int main(){ int x1,y1,x2,y2; double r,d,k,l,s; while(cin>>x1>>y1>>x2>>y2>>r){ d=sqrt(pow(x1-x2,2)+pow(y1-y2,2)); if(x1==x2&&y1==y2) cout<<"重合"<<endl; else if(d==2*r) cout<<"相切"<<endl; else if(d>2*r) cout<<"相离"<<endl; else if(d<2*r){ k = acos(d/2.0/r); s=r*k*r-(r*d*sin(k))/2.0; cout<<"相交"<<" "<<fixed<<setprecision(2)<<s<<endl; } } return 0; } |
Double click to view unformatted code.