poj1328】的更多相关文章

[POJ1328]Radar Installation 试题描述 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 onl…
题目链接: https://vjudge.net/problem/POJ-1328 题目大意: 假设陆地的海岸线是一条无限延长的直线,海岛是一个个的点,现需要在海岸线上安装雷达,使整个雷达系统能够覆盖到所有的海岛.雷达所能覆盖的区域是以雷达为圆心半径为d的圆,我们用指标坐标系来描述,海岸线就是x轴,现在给出每个海岛的坐标与雷达的半径d,请编写一个程序计算出最少需要多少个雷达才能够将所有海岛全部覆盖? 思路: 该题题意是为了求出能够覆盖所有岛屿的最小雷达数目,每个小岛对应x轴上的一个区间,在这个区…
https://vjudge.net/problem/POJ-1328 贪心策略选错了恐怕就完了吧.. 一开始单纯地把island排序,然后想从左到右不断更新,其实这是错的...因为空中是个圆弧. 后来知道了通过对每个island求雷达范围,将这些范围排序,但是去重策略也没想对.因为有两种情况,都需要更新t值,但是只有一种需要ans++. #include<iostream> #include<cstdio> #include<queue> #include<cs…
POJ2376 Cleaning Shifts Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 14585   Accepted: 3718 Description Farmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleaning chores around the barn. He always wants to hav…
http://http://poj.org/problem?id=1328 神TM贪心. 不懂请自行搜博客. AC代码: #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using namespace std; struct Node { double l; double r; } node[],temp; int cmp(Node x,Node y) { retu…
Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 60381   Accepted: 13610 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 loca…
Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 73588   Accepted: 16470 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 loca…
POJ 1328,题目链接http://poj.org/problem?id=1328 题意: 有一海岸线(x轴),一半是陆地(y<0).一半是海(y>0),海上有一些小岛(用坐标点表示P1.P2...),现要在海岸线上建雷达(覆盖半径R).给出所有小岛的位置,和雷达半径,求最少需要多少个雷达? 思路: 1. 知道小岛位置,和雷达半径,那么以小岛为圆心,雷达覆盖半径为半径画圆,可以求出小岛与x轴有0(雷达无法覆盖).1(雷达只能在这个点上才能覆盖).2个交点(雷达在两点之间都能覆盖该小岛) 2…
Radar Installation 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…
题目链接. 题意: 给定一坐标系,要求将所有 x轴 上面的所有点,用圆心在 x轴, 半径为 d 的圆盖住.求最少使用圆的数量. 分析: 贪心. 首先把所有点 x 坐标排序, 对于每一个点,求出能够满足的 最靠右的圆心,即雷达的位置. 要保证雷达左面的点都被覆盖,如果不能覆盖就向左移,移到能将左边未覆盖的覆盖.如果后面的店不在雷达的覆盖区,则再加一雷达. #include <iostream> #include <cstdio> #include <cstdlib> #i…