Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
60433 | Ender | S1 | C++ | 通过 | 100 | 651 MS | 272 KB | 1009 | 2022-10-15 11:34:37 |
#include <iostream> #include <cmath> #include <iomanip> #include <cstdio> using namespace std; inline double Dis(double a1,double b1,double a2,double b2) { double AK = abs((a1 - a2) * (a1 - a2) + (b1 - b2) * (b1 - b2)); return sqrt(AK); } int main() { //freopen("S1.in","r",stdin); //freopen("S1.out","w",stdout); cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); int T; cin>>T; while(T--) { double x1,xx1,x2,xx2,x3,xx3,x4,xx4,r; double k1,b1,k2,b2; cin>>x1>>xx1>>x2>>xx2>>x3>>xx3>>r; if(x1 != x2&&xx1 != xx2) { k1 = (xx1 - xx2) / (x1 - x2); b1 = xx1 - k1 * x1; k2 = -1.0 / k1; b2 = xx3 - k2 * x3; x4 = (b2 - b1) / (k1 - k2); xx4 = k1 * x4 + b1; } else if(x1 == x2) { x4 = x1; xx4 = xx3; } else { x4 = x3; xx4 = xx1; } cout<<fixed<<setprecision(2)<<Dis(x4,xx4,x3,xx3) - r<<' '; cout<<fixed<<setprecision(2)<<max(Dis(x1,xx1,x3,xx3),Dis(x2,xx2,x3,xx3)) + r<<endl; } return 0; }