提交时间:2022-10-15 11:29:10
运行 ID: 60387
#include<bits/stdc++.h> using namespace std; int t; double ax,ay,bx,by,cx,cy,r; double l1,l2,l3,x,ans; double ojld(double a,double b,double c,double d){ double an; an=abs(a-c)*abs(a-c)+abs(b-d)*abs(b-d); an=sqrt(an); return an; } int main(){ // freopen("S1.in","r",stdin); // freopen("S1.out","w",stdout); scanf("%d",&t); while(t--){ scanf("%lf%lf%lf%lf%lf%lf%lf",&ax,&ay,&bx,&by,&cx,&cy,&r); l1=ojld(ax,ay,cx,cy); l2=ojld(bx,by,cx,cy); l3=ojld(ax,ay,bx,by); if(l1<=l2) swap(l1,l2); x=(l1*l1-l2*l2+l3*l3)/l3/2; ans=l1*l1-x*x; ans=sqrt(ans); printf("%.2lf %.2lf\n",ans-r,l1+r); } return 0; }