| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1026 人关注过本帖
标题:求助: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
快速回复:求助:The Problem of the Number of Intersections
数据加载中...
 
   



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

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