提交时间:2022-10-15 11:26:53
运行 ID: 60345
#include<bits/stdc++.h> using namespace std; double dist(int x1,int y1,int x2,int y2) { return sqrt((long long)(x1-x2)*(x1-x2)+(long long)(y1-y2)*(y1-y2)); } int main() { // freopen("S1.in","r",stdin); // freopen("S1.out","w",stdout); int T; scanf("%d",&T); int x1,y1,x2,y2,x3,y3,r; while(T--) { scanf("%d%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3,&r); double a=y1-y2,b=x2-x1,c=(long long)x1*y2-(long long)x2*y1; double ans1=fabs(a*x3+b*y3+c)/sqrt(a*a+b*b)-r,ans2=max(dist(x1,y1,x3,y3)+r,dist(x2,y2,x3,y3)+r); printf("%.2lf %.2lf\n",ans1,ans2); } return 0; }