网站大量收购闲置独家精品文档,联系QQ:2885784924

1688DolphinPool解题报告.doc

  1. 1、本文档共3页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
1688DolphinPool解题报告

解题报告:Dolphin Pool 题目来源: No. 1688 解法或类型: 几何计数 作者:杭杰 Dolphin Pool Time Limit:1S? Memory Limit:1000K Total Submit:7 Accepted:5 Description In a newly constructed dolphin pool in the Kish island in Persian Gulf, one of the fun games is as follows: the game director throws several plastic rings in the pool such that center of no ring lies inside any other ring, and no two rings are tangent. The dolphins are trained to jump out on the directors whistle through the closed areas that are completely outside the rings, one dolphin from one such area. The dolphins jump out if and only if the number of closed areas exactly equals to the number of dolphins. You are to write a program to given the following input/output description, finds the number of closed areas between rings to help the dolphins decide to jump out or not. Input The first line includes the number of test cases (at most 20). Each test case data has an integer N (1 = N = 20), the number of plastic rings, in its first line. Following the first line there are N lines, each containing three integers, the first and second being the x and y coordinates of the circle of the ring, and the third is its radius. Coordinates are positive integers less than 1000 and the radius is in the range 1...100. Output For each test case, there must be one line in the output including the number of closed areas in that test case. Sample Input 2 4 100 100 20 100 135 20 135 100 20 135 135 20 1 10 10 40 Sample Output 1 0 Source Tehran 2000 解题思路: 先求出n个圆之间的两两相交情况及其交点,保存未被其它圆覆盖的交点,并对每个圆上的交点按照到圆心的极角排序,规定逆时针方向为正方向,并用一定的标记区分圆弧相交部分、边界部分和交点之间的位置关系。这里用‘+’表示外边界在焦点的正方向。 从每个标记为‘+’且未被访问过的交点出发,顺着正方向寻找下一个交点,并转移到下一个圆上继续寻找,直至一个已访问的交点。这时就找到了一个环。有如下两种情况: 从1开始,沿着1、2、3、4顺序访问,找到一个小区域; 从5开始,沿着5、6、7、8顺序访问,找到ABCD组成的连通区域的外边界。 1)和2)的区别在于旋转方向不同,1)是顺时针方向,2)是逆时针方向(正方向)。具体判断可以用有向面积来实现,在访问过程中计算有向面积,最后有向面积为正值的区域为需要统计的区域。 特殊情况:多点共圆 处理方法:对边界上的交点,只要不在任何圆内部,都保存下来,允许出现多点重合,如图中的三圆交点作为AB、BC、AC的交点被保存3次。由于圆之间的位置关系不同,上述两种情况下,根据交点标记不同,访问路径也不同。用圆的标号来表示,左图访问路径为ABCA,右图访问路径

文档评论(0)

liangyuehong + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档