提交时间:2022-10-17 13:50:03

运行 ID: 60841

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