Greedy:Radar Installation(POJ 1328)】的更多相关文章

装雷达 题目大意,就是令在海岸线的(直线)一边是海(y>0),另一边是陆地(y<=0),在海岸线上装雷达,雷达可以覆盖的范围为d,海上有岛,(x,y),问你应该怎么装雷达,才能做到技能雷达的检测范围覆盖全部的岛,又能使雷达安装最少?(不能做到输出-1) 我的思路,首先是把岛排一次序,然后从x坐标最小的那个岛开始贪心算法,怎么做呢?那就是用x=sqrt(d*d-y*y)+xa,来获得当前岛的安装最远的雷达的位置,然后不断往前找,在超越当前雷达圆心距离之前,不断缩小雷达的位置,使雷达能覆盖到更多的…
Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, locating on the coasting, can only cover d distance, so an island…
Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, locating on the coasting, can only cover d distance, so an island…
题目大意(vj上的翻译版本) 假定海岸线是无限长的直线.陆地位于海岸线的一侧,海洋位于另一侧.每个小岛是位于海洋中的一个点.对于任何一个雷达的安装 (均位于海岸线上),只能覆盖 d 距离,因此海洋中的小岛被雷达安装所覆盖的条件是两者间的距离不超过 d . 我们使用卡笛尔坐标系,将海岸线定义为 x 轴.海洋的一侧位于 x 轴上方,陆地的一侧位于下方.给定海洋中每个小岛的位置,并给定雷达安装的覆盖距离,您的任务是写一个程序,找出雷达安装的最少数量,使得所有的小岛都被覆盖.注意:小岛的位置以它的 x-…
题目地址:http://poj.org/problem?id=1328 /* 贪心 (转载)题意:有一条海岸线,在海岸线上方是大海,海中有一些岛屿, 这些岛的位置已知,海岸线上有雷达,雷达的覆盖半径知道, 问最少需要多少个雷达覆盖所有的岛屿. (错误)思路:我开始是想从最左边的点雷达能探测的到的最右的位置出发,判断右边其余的点是否与该点距离小于d 是,岛屿数-1:不是,雷达数+1,继续... (正确)思路:每个岛屿的座标已知,以雷达半径为半径画圆,与x轴有两个交点. 也就是说,若要覆盖该岛,雷达…
1.Link: http://poj.org/problem?id=1328 http://bailian.openjudge.cn/practice/1328/ 2.Content: Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 52833   Accepted: 11891 Description Assume the coasting is an infinite straig…
Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 42925   Accepted: 9485 Description Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locat…
POJ 1328 Radar Installation https://vjudge.net/problem/POJ-1328 题目: Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation…
点击打开链接 Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 43490   Accepted: 9640 Description Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a poin…
Radar Installation Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 20000/10000K (Java/Other) Total Submission(s) : 22   Accepted Submission(s) : 9 Problem Description Assume the coasting is an infinite straight line. Land is in one side of coa…