提交时间:2022-10-15 11:30:35

运行 ID: 60411

#include <bits/stdc++.h> using namespace std; double x1,y1,x2,y2,x3,y3,r; double ans1,ans2; int A(int x) { if(x<0) return -x; return x; } int main() { int t; scanf("%d",&t); while(t--) { scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2); scanf("%lf%lf%lf",&x3,&y3,&r); if(x1==x2) { ans1=A(x1-x3)-r; ans2=sqrt(pow(A(x1-x3),2)+pow(max(A(y1-y3),A(y2-y3)),2))+r; } else if(y1==y2) { ans1=A(y1-y3)-r; ans2=sqrt(pow(max(A(x1-x3),A(x2-x3)),2)+pow(A(y1-y3),2))+r; } printf("%.2lf %.2lf\n",ans1,ans2); } return 0; }