当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3397:Click the Lines

题目描述

In many graphic drawing applications, you can click on a line object. A well-known approach to detect if a line is clicked by a mouse is to compute the distance between the click position and the line. For example, in Figure 1, the line is said to be selected if the distance d is less than a threshold D (dD).

Give you a set of lines (with equation of the form ax + by + c = 0), please compute the minimum clicks to select all the lines. For example, to select two lines, the minimum number of clicks is one, that is, you can make a click near the cross point of the two lines.

Note: In the test data, each line at least intersects with another line.

输入解释

The first line of input data begins with a number N the number of test cases. Each test case begins with two integers L and D, where L (L ≤ 200) is the number of lines and D (D > 0) is the threshold for testing if a line is selected. The data of lines listed one by one. Each line is represented by (ax + by + c = 0). The three floating numbers a, b, c, separated by space are given to represent the line.

输出解释

Please output the minimum number of clicks in a new line for each test case.

输入样例
2
2 5
0 1 0
1 0 0
3 1
0 1 0
1 0 0
1 1 2
输出样例
1
2

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Kaohsiung 2006

源链接: POJ-3397

最后修改于 2020-10-29T07:00:39+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
5000 65536