QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#541579#9227. Henry the PlumberdsbdsbWA 0ms3712kbC++141.4kb2024-08-31 20:05:002024-08-31 20:05:01

Judging History

你现在查看的是最新测评结果

  • [2024-08-31 20:05:01]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3712kb
  • [2024-08-31 20:05:00]
  • 提交

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+a,y+b},{u,v},{u+c,v+d});
//			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: 3704kb

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: 0ms
memory: 3712kb

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
3
4
4
4
4
3
4
4
4
4
4
4
4
4
4
4
4
3
4
4
3
4
4
4
3
4
4
4
4
3
4
4
4
4
4
4
4
3
4
4
3
4
4
4
3
3
3
4
4
3
4
4
4
4
4
4
4
3
4
3
4
3
4
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
4
4
4
4
4
4
4
4
4
3
4
4
4
3

result:

wrong answer 6th numbers differ - expected: '4', found: '3'