poj1328 Radar Installation
来源:互联网 发布:win7网络图标灰色 编辑:程序博客网 时间:2024/05/22 06:05
原题: http://poj.org/problem?id=1328
//经典区间覆盖问题 #include<iostream>#include<cstdio>#include<math.h>#include<algorithm>using namespace std;struct range{double x;double y;}r[1001];int cmp(range a,range b){return a.x<b.x;}int main(){int n,d;int c=0;scanf("%d %d",&n,&d);while(n!=0||d!=0){c++;int i;double x,y;int count=1;for(i=0;i<n;i++){scanf("%lf %lf",&x,&y);if(y>d){count=-1;}r[i].x=x-sqrt(d*d-y*y);r[i].y=x+sqrt(d*d-y*y);}sort(r,r+n,cmp);if(count!=-1){double s=r[0].y;for(i=1;i<n;i++){if(r[i].x>s){count++;s=r[i].y;}if(r[i].x<s&&r[i].y<s){s=r[i].y;}}}printf("Case %d: %d\n",c,count);scanf("%d %d",&n,&d);}} //AC
阅读全文
0 0
- POJ1328 Radar Installation
- POJ1328 Radar Installation 贪心
- POJ1328----Radar Installation
- POJ1328:Radar Installation
- poj1328 Radar Installation
- poj1328--Radar Installation
- poj1328 Radar Installation
- POJ1328 Radar Installation
- POJ1328 &AOJ195 Radar Installation
- POJ1328 Radar Installation 贪心
- 【贪心】POJ1328 Radar Installation
- poj1328 Radar Installation 贪心
- poj1328--Radar Installation
- POJ1328-Radar Installation
- POJ1328 radar installation (Greedy)
- poj1328--Radar Installation
- 【POJ1328】Radar Installation 贪心
- POJ1328 Radar Installation 贪心
- 史上最简单的 MySQL 教程(二十三)「数据的高级操作 之 查询(上)」
- 数组
- python 控制adb
- (hdu6033)Add More Zero(数学,取对数)
- C++中extern函数介绍
- poj1328 Radar Installation
- apt-get install 时lock问题
- 史上最简单的 MySQL 教程(二十四)「数据的高级操作 之 查询(中)」
- 干货:Dao单元测试项目实战
- 学习之道的总结
- 【Python】Numpy中的tile方法介绍
- 使用python经常出现NameError: name 'xxx' is not defined
- 常见数学符号
- 多线程之概念字典