poj1328 Radar Installation —— 贪心】的更多相关文章

题目链接. 题意: 给定一坐标系,要求将所有 x轴 上面的所有点,用圆心在 x轴, 半径为 d 的圆盖住.求最少使用圆的数量. 分析: 贪心. 首先把所有点 x 坐标排序, 对于每一个点,求出能够满足的 最靠右的圆心,即雷达的位置. 要保证雷达左面的点都被覆盖,如果不能覆盖就向左移,移到能将左边未覆盖的覆盖.如果后面的店不在雷达的覆盖区,则再加一雷达. #include <iostream> #include <cstdio> #include <cstdlib> #i…
题目链接:http://poj.org/problem?id=1328 题解:区间选点类的题目,求用最少的点以使得每个范围都有点存在.以每个点为圆心,r0为半径,作圆.在x轴上的弦即为雷达可放置的范围.这个范围可用勾股定理求得.记录每个点的范围,然后排序,贪心. (由于不熟悉qsort的用法,折腾了一个小时.后来清晰了:qsort 的cmp是通过正负判断(但结构体又不是),而sort的cmp是通过对错判断,即0或1.所以qsort的cmp用‘-’(结构体除外),sort的cmp用‘<’和‘>’…
[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…
题目:Radar Installation 对于x轴上方的每个建筑 可以计算出x轴上一段区间可以包含这个点 所以就转化成 有多少个区间可以涵盖这所有的点 排序之后贪心一下就ok 用cin 好像一直t看了好多blog 改了scanf 过了 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<queue> #include<cmat…
Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 54593   Accepted: 12292 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 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 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…
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: 56826   Accepted: 12814 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…
Language: Default Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 42461   Accepted: 9409 Description Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small islan…