#include<bits/stdc++.h> using namespace std; #define max 50 int main(){ double l,R,mm,gg,S,r, x1,x2,y1,y2; while(cin>>x1>>y1>>x2>>y2>>r){ l = sqrt(abs(x1-x2)*abs(x1-x2) + abs(y1-y2)*abs(y1-y2)); 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*0.5/r); gg=mm*r*r; S=gg-0.5*r*r*sin(mm); S=S*2; printf("%.2f\n",S); } } return 0; } |
Double click to view unformatted code.