提交时间:2024-01-02 13:37:25
运行 ID: 118914
#include<bits/stdc++.h> using namespace std; double x[5],y[5],r,p,S,h,maxn,minn,dis1,dis2,dis3; int t; int main(){ scanf("%d",&t); while(t--){ scanf("%lf%lf%lf%lf%lf%lf%lf",&x[1],&y[1],&x[2],&y[2],&x[3],&y[3],&r); dis1=sqrt((x[1]-x[3])*(x[1]-x[3])+(y[1]-y[3])*(y[1]-y[3])); dis2=sqrt((x[2]-x[3])*(x[2]-x[3])+(y[2]-y[3])*(y[2]-y[3])); dis3=sqrt((x[1]-x[2])*(x[1]-x[2])+(y[1]-y[2])*(y[1]-y[2])); maxn=max(dis1,dis2)+r; p=(dis1+dis2+dis3)/2; S=sqrt(p*(p-dis1)*(p-dis2)*(p-dis3)); h=2*S/dis3; minn=h-r; printf("%.2lf ",minn); printf("%.2lf\n",maxn); } return 0; }