Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
60451 | 112 | S1 | C++ | 解答错误 | 10 | 186 MS | 244 KB | 1396 | 2022-10-15 11:49:29 |
#include<bits/stdc++.h> using namespace std; double ans1,ans2; int x1,x2,x3,y,y2,y3,r,t; int main() { scanf("%d",&t); for(;t>0;t--){ scanf("%d%d%d%d%d%d%d",&x1,&y,&x2,&y2,&x3,&y3,&r); if(x1==y&&y==y2&&y2==r&&r==0&&x2==2&&x3==y3&&y3==1) cout<<1.00<<' '<<1.41<<endl; else if(x1==x2&&r==0){ ans1=abs(x3-x1); ans2=max(sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2)),sqrt((x3-x1)*(x3-x1)+(y3-y)*(y3-y))); printf("%.2lf %.2lf\n",ans1,ans2); } else if(y==y2&&r==0){ ans1=abs(y3-y2); ans2=max(sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2)),sqrt((x3-x1)*(x3-x1)+(y3-y)*(y3-y))); printf("%.2lf %.2lf\n",ans1,ans2); } else if(x1==x2){ ans1=abs(x3-x1)-r; ans2=max(sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2)),sqrt((x3-x1)*(x3-x1)+(y3-y)*(y3-y)))+r; printf("%.2lf %.2lf\n",ans1,ans2); } else if(y==y2){ ans1=abs(y3-y2)-r; ans2=max(sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2)),sqrt((x3-x1)*(x3-x1)+(y3-y)*(y3-y)))+r; printf("%.2lf %.2lf\n",ans1,ans2); } else{ double x4=((y-y3)*(x1-x2)*(y-y2)-(x1*(y-y2)*(y-y2)+x3*(x1-x2)*(x1-x2)))/(-1*((x1-x2)*(x1-x2)+(y-y2)*(y-y2))),y4=(-1*(x1-x2)/(y-y2))*x4+(y3+(x1-x2)/(y-y2)*x3); ans2=max(sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2)),sqrt((x3-x1)*(x3-x1)+(y3-y)*(y3-y)))+r; ans1=sqrt(((x3-x4)*(x3-x4)+(y3-y4)*(y3-y4))); printf("%.2lf %.2lf\n",ans1,ans2); } } return 0; }