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 locating in the sea side. And any radar installation, locating on the coasting, can only cover d distance, s…
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28415#problem/A 题目大意:X轴为海岸线可放雷达监测目标点,告诉n个目标点和雷达监测半径,求最少多少个雷达可全覆盖,如果不能输出-1: 解题思路:赤裸裸的区间选点问题(数轴上有n个闭区间,去尽量少的点,使每个区间至少有一个点).核心思想就是贪心算法:把所有区间按照b从小到大的顺序(b相同时按a从大到小的顺序),贪心策略:第一区间取最后一个点,然后跳过接下来包含该点的区间,直到…
题目地址:http://poj.org/problem?id=1328 /* 贪心 (转载)题意:有一条海岸线,在海岸线上方是大海,海中有一些岛屿, 这些岛的位置已知,海岸线上有雷达,雷达的覆盖半径知道, 问最少需要多少个雷达覆盖所有的岛屿. (错误)思路:我开始是想从最左边的点雷达能探测的到的最右的位置出发,判断右边其余的点是否与该点距离小于d 是,岛屿数-1:不是,雷达数+1,继续... (正确)思路:每个岛屿的座标已知,以雷达半径为半径画圆,与x轴有两个交点. 也就是说,若要覆盖该岛,雷达…
解题思路:给出n个岛屿,n个岛屿的坐标分别为(a1,b1),(a2,b2)-----(an,bn),雷达的覆盖半径为r 求所有的岛屿都被覆盖所需要的最少的雷达数目. 首先将岛屿坐标进行处理,因为雷达的位置在x轴上,所以我们设雷达的坐标为(x,0),对于任意一个岛屿p(a,b),因为岛屿要满足在雷达的覆盖范围内,所以 (x-a)^2+b^2=r^2,解得 xmin=a-sqrt(r*r-b*b);//即为区间的左端点 xmax=a+sqrt(r*r-b*b);//即为区间的右端点 接下来区间选点即…
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…
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…
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 locating in the sea side. And any radar installation, locating on the coasting, can only cover d distance, s…
Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 106491   Accepted: 23648 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 loc…
Radar Installation 原文是English,直接上中文 Descriptions: 假定海岸线是无限长的直线.陆地位于海岸线的一侧,海洋位于另一侧.每个小岛是位于海洋中的一个点.对于任何一个雷达的安装 (均位于海岸线上),只能覆盖 d 距离,因此海洋中的小岛被雷达安装所覆盖的条件是两者间的距离不超过 d . 我们使用卡笛尔坐标系,将海岸线定义为 x 轴.海洋的一侧位于 x 轴上方,陆地的一侧位于下方.给定海洋中每个小岛的位置,并给定雷达安装的覆盖距离,您的任务是写一个程序,找出雷…
点击打开链接 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…