QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#541967 | #9227. Henry the Plumber | dsbdsb | WA | 0ms | 3840kb | C++14 | 1.7kb | 2024-08-31 21:48:59 | 2024-08-31 21:49:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
double a,b,c,d,x,y,z,u,v,w,eps=1e-9;
struct point{
double x,y;
inline point operator + (const point &rhs)const{
return (point){x+rhs.x,y+rhs.y};
}
inline point operator - (const point &rhs)const{
return (point){x-rhs.x,y-rhs.y};
}
inline point operator * (const double &rhs)const{
return (point){x*rhs,y*rhs};
}
inline bool operator == (const point &aa)const{
return (fabs(x-aa.x)<eps&&fabs(y-aa.y)<eps);
}
inline void prt(){
printf("%.2lf %.2lf\n",x,y);
}
};
inline double cross(const point &lhs,const point &rhs){
return lhs.x*rhs.y-lhs.y*rhs.x;
}
inline point inter(point p1,point p2,point p3,point p4){
double ls=cross(p2-p1,p3-p1),rs=cross(p4-p1,p2-p1);
// p1.prt(),p2.prt(),p3.prt(),p4.prt();
// std::cout<<ls<<' '<<rs<<'\n';
return p3+(p4-p3)*(ls/(ls+rs));
}
int main(){
// std::cout<<inter({0,0},{1,9},{0,9},{1,0}).y<<'\n';
int T;
cin>>T;
while(T--){
cin>>x>>y>>z>>a>>b>>u>>v>>w>>c>>d;
if(x==u&&y==v) cout<<"2\n";
else if((fabs(a*d-b*c)<=eps)){
if(fabs(a*(x-u)+b*(y-v))<=eps) cout<<"2\n";
else{
cout<<"4\n";
// if((fabs(a*(y-v)+b*(x-u))<=eps||fabs(a*(y-v)-b*(x-u))<=eps)&&z==w) cout<<"4\n";
// else cout<<"3\n";
}
}
else{
point e=inter({x,y},{x+b,y-a},{u,v},{u+d,v-c});
if(z==w&&(e==(point){x,y}||e==(point){u,v})){
cout<<"4\n";
continue;
}
// printf("%.2f %.2f !!\n",e.x,e.y);
double fz=(x-e.x)*(x-e.x)+(y-e.y)*(y-e.y)+(u-e.x)*(u-e.x)+(v-e.y)*(v-e.y);
printf("%.6f %.6f %.6f %.6f !!!\n",e.x,e.y,fz,(x-u)*(x-u)+(y-v)*(y-v)+(z-w)*(z-w)/2);
if(fz>eps+(x-u)*(x-u)+(y-v)*(y-v)+(z-w)*(z-w)/2) cout<<"4\n";
else cout<<"3\n";
}
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3840kb
input:
2 -1 -1 3 1 1 2 2 3 2 2 5 5 1 3 0 7 6 -2 1 -2
output:
4 5.000000 5.000000 5.000000 9.500000 !!! 3
result:
wrong output format Expected integer, but "5.000000" found