【解题报告】BUPT Online Judge Volume 9 Problem 1805 Segments【计算几何】(水题。因为不会用叉积做,自玩了无数次才AC)

Segments

Submit: 386   Accepted:62

Time Limit: 1000MS  Memory Limit: 65536K

Description
There are some segments on the plane, we assume there 4 possible position concepts for every 2 segments: no common point, countless common points, one common point and the point is also the endpoint of either segment, one common point but the point is not the endpoint of either segment.
译文:平面上有若干线段。线段两两间存在4种可能的位置关系:无公共点,无数公共点,一个公共点且为其中一条的端点,一个公共点但不是端点。


tupian

 

 

Input
The first line of the input is an integer T, which represents that there are T test cases.
An integer n indicating the number of segments
n line follows, 4 integers per line, x1, y1, x2, y2, representing the coordinates of the endpoints of both segments .(1<=n<=100)
译文:第一行测试数据组数T;第二行每组中线段数n;接下来n行线段两端点的二维坐标。(n不超过100)

Output
For each test case, please output 4 line, 1 integer per line
For the first line, please output the number of pairs of segments that have no common point
For the second line, please output the number of pairs of segments that have countless common point
For the third line, please output the number of pairs of segments that have 1 common point and the point is also the endpoint of either segment
For the fourth line, please output the number of pairs of segments that have 1 common point and the point is not the endpoint.
After each case output a blank line include the last case

译文:输出四行,分别是对应四种情况的线段对的数目,每组测试数据后输出一个空行。

Sample Input

2
3
-1 0 1 0
0 -1 0 1
-1 2 1 2
3
1 0 3 0
2 0 4 0
4 0 5 0


Sample Output

2
0
0
1

1
1
1
0


Source
第四届北京邮电大学程序设计竞赛决赛

 

 Code

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值