QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#541759 | #9227. Henry the Plumber | dsbdsb | WA | 1ms | 3812kb | C++14 | 1.4kb | 2024-08-31 20:52:30 | 2024-08-31 20:52:31 |
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 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((a*d+b*c==0||a*d-b*c==0)){
if(a*(x-u)+b*(y-v)==0) cout<<"2\n";
else{
// cout<<"4\n";
if(a*(y-v)+b*(x-u)==0||a*(y-v)-b*(x-u)==0) cout<<"4\n";
else cout<<"3\n";
}
}
else{
point e=inter({x,y},{x+b,y-a},{u,v},{u+d,v-c});
// 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);
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: 100
Accepted
time: 0ms
memory: 3796kb
input:
2 -1 -1 3 1 1 2 2 3 2 2 5 5 1 3 0 7 6 -2 1 -2
output:
4 3
result:
ok 2 number(s): "4 3"
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3812kb
input:
100 -13 -5 -7 -19 19 -19 -13 0 -7 15 -20 20 19 -17 18 20 -20 -1 18 -19 -18 15 -14 -19 18 19 -20 6 20 -19 -12 9 1 7 -16 -13 -14 -8 8 -13 -19 16 9 20 -19 19 -18 -11 19 -18 19 20 -8 12 20 -11 -9 18 -19 -18 8 11 -13 12 -18 18 13 8 4 -18 -16 20 17 -19 18 20 -18 -3 20 -19 -17 -20 -5 -18 -19 19 16 15 19 20...
output:
4 4 4 4 4 4 3 4 4 4 3 4 4 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 3 4 4 4 4 4 3 4 3 4 4 4 3 4 4 4 4 4 4 4 3 4 3 4 4 4 4 4 4 4 4 4 4 4 4 3 4 4 4 4 4 4 4 3 3 4 3 4 4 4 4 4 4 4 4 4
result:
wrong answer 16th numbers differ - expected: '4', found: '3'