#include<iostream> #include<cmath> using namespace std; int main(){ double x1,y1,x2,y2,r; while (scanf("%lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&r)!=EOF){ double d=sqrt(pow(fabs(x1-x2),2)+pow(fabs(y1-y2),2)); if(d==2*r){ cout<<"相切"<<endl; } else if(d==0){ cout<<"重合"<<endl; } else if(d>2*r){ cout<<"相离"<<endl; } else{ double ang1=acos(d/(2*r)); printf("相交 %.2f\n",2*ang1*r*r-r*d*sin(ang1)); } } } |
Double click to view unformatted code.