提交时间:2022-10-15 11:49:25
运行 ID: 60450
#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() { // freopen("S1.in","r",stdin); // freopen("S1.out","w",stdout); int t; scanf("%d",&t); while(t--) { cin>>x1>>y1>>x2>>y2>>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("%.2f %.2f\n",ans1,ans2); } return 0; }