提交时间:2022-10-15 11:30:04
运行 ID: 60406
#include<bits/stdc++.h> using namespace std; inline double dis(int x,int y,int xx,int yy){ return sqrt(1.0*(x-xx)*(x-xx)+1.0*(y-yy)*(y-yy)); } int main(){ int t,x1,x2,x3,y1,y2,y3,r; cin>>t; while(t--){ cin>>x1>>y1>>x2>>y2>>x3>>y3>>r; if(x1==x2){ double ans1=abs(x3-x2)-r,ans2=max(dis(x1,y1,x3,y3),dis(x2,y2,x3,y3))+r; printf("%.2f %.2f\n",ans1,ans2); } else if(y1==y2){ double ans1=abs(y3-y2)-r,ans2=max(dis(x1,y1,x3,y3),dis(x2,y2,x3,y3))+r; printf("%.2f %.2f\n",ans1,ans2); } else{ double ans1=1.0*dis(x1,y1,x3,y3)+r,ans2=1.0*dis(x2,y2,x3,y3)-r; printf("%.2f %.2f\n",ans2,ans1); } } return 0; }