#include<bits/stdc++.h> using namespace std; #define max 50 int main(){ double l,R,mm,gg,S,r, x1,x2,y1,y2,nn; while(~scanf("%lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&r)){ l = sqrt(pow(x1-x2,2) + pow(y1-y2,2)); if(l==0)cout<<"重合"<<endl; else if(2*r == l)cout<<"相切"<<endl; else if(l > 2*r) cout<<"相离"<<endl; else if(l < 2*r){ cout<<"相交"<<" "; mm=acos(l/2.0/r); gg=mm*r*r/2.0; nn=l*r*sin(mm)/4.0; S = 4.0*(gg-nn); printf("%.2f\n",S); } } return 0; } |
Double click to view unformatted code.