标题:求助:The Problem of the Number of Intersections
只看楼主
莫北
Rank: 1
来 自:内蒙古师范大学
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-3-16
 问题点数:0 回复次数:0 
求助:The Problem of the Number of Intersections
Description

Many geometry(几何)problems were designed in the ACM/ICPC. And now, I also prepare a geometry problem for this final exam. According to the experience of many ACMers, geometry problems are always much trouble, but this problem is very easy, after all we are now attending an exam, not a contest :)
Give you N (1<=N<=100) segments, please output the number of all intersections. You should count repeatedly if M (M>2) segments intersect at the same point.
Note:
You can assume that two segments would not intersect at more than one point.



Input

Input contains multiple test cases. Each test case contains a integer N (1=N<=100) in a line first, and then N lines follow. Each line describes one segment with four float values x1, y1, x2, y2 which are coordinates of the segment’s ending.
A test case starting with 0 terminates the input and this test case is not to be processed.



Output

For each case, print the number of intersections, and one line one case.



Sample Input


2
0.00 0.00 1.00 1.00
0.00 1.00 1.00 0.00
3
0.00 0.00 1.00 1.00
0.00 1.00 1.00 0.000
0.00 0.00 1.00 0.00
0

Sample Output


1
3
搜索更多相关主题的帖子: Problem The Number 
2008-03-16 15:58



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-203680-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.040991 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved