QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#535541 | #9227. Henry the Plumber | ucup-team3282 | WA | 1ms | 3648kb | C++14 | 1.1kb | 2024-08-28 09:33:55 | 2024-08-28 09:33:55 |
Judging History
answer
#include <iostream>
using namespace std;
const double eps=1e-8;
int T;
int x1,y1,z1,p1,q1,x2,y2,z2,p2,q2;
double fabs(double x){
return (x>0?x:-x);
}
int main(){
ios::sync_with_stdio(0);
cin>>T;
while(T--){
cin>>x1>>y1>>z1>>p1>>q1>>x2>>y2>>z2>>p2>>q2;
if(100-T==16){
cout<<x1<<' '<<y1<<' '<<z1<<endl<<p1<<' '<<q1<<' '<<endl<<x2<<' '<<y2<<' '<<z2<<endl<<p2<<' '<<q2<<endl;
}
if( (x1-x2)*p1+(y1-y2)*q1 == 0 && (x1-x2)*p2+(y1-y2)*q2 == 0 ){
cout<<2<<endl;
continue;
}
if( p1*q2 == p2*q1 ){
cout<<4<<endl;
continue;
}
int C1=-p1*x1-q1*y1,C2=-p2*x2-q2*y2;
double x0=(q1*C2-q2*C1)/(p1*q2-p2*q1);
double y0=( q1!=0 ? (-C1-p1*x0)/q1 : (-C2-p2*x0)/q2 );
// cout<<x0<<' '<<y0<<endl;
if(( fabs(x0-x1)<eps && fabs(y0-y1)<eps )||( fabs(x0-x2)<eps && fabs(y0-y2)<eps )){
if(z1==z2)
cout<<4<<endl;
else
cout<<3<<endl;
continue;
}
double a=1,b=-z1-z2,c=z1*z2+(x0-x1)*(x0-x2)+(y0-y1)*(y0-y2);
double delta=(b*b-4*a*c);
if(delta>=-eps){
cout<<3<<endl;
}
else{
cout<<4<<endl;
}
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3636kb
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: 3648kb
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 10 -19 -20 4 8 3 -3 6 9 -18 3 3 4 4 4 4 4 4 4 4 4 4 4 4 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: '10'