提交时间:2022-10-15 11:26:15
运行 ID: 60339
#include<bits/stdc++.h> using namespace std; int t; inline double Dis(int l,int r,int s,int t) { return sqrt(pow(abs(l-s),2)+pow(abs(r-t),2)); } inline int read() { int x=0,f=0; char c=getchar(); for(;c<'0' || c>'9';f^=(c=='-'),c=getchar()); for(;'0'<=c && c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48); return f?-x:x; } signed main() { //freopen("S1.in","r",stdin); //freopen("S1.out","w",stdout); t=read(); while(t--) { register int a,b,c,d,e,f,r; a=read(),b=read(),c=read(),d=read(),e=read(),f=read(),r=read(); double dis1=Dis(a,b,e,f),dis2=Dis(c,d,e,f),dis3=Dis(a,b,c,d); double x=(dis2*dis2+dis3*dis3-dis1*dis1)/(2*dis3); double ans1=sqrt(pow(dis2,2)-pow(x,2))-r; double ans2=max(dis2,dis1)+r; printf("%.2lf %.2lf\n",ans1,ans2); } return 0; }