ZOJ 1041 Transmitters
来源:互联网 发布:js鼠标移动到图片放大 编辑:程序博客网 时间:2024/05/16 16:55
Description
以雷达心为圆心的半圆形雷达覆盖范围有多个点 雷达可旋转,求最多覆盖数(含在边界的)
Input
Output
Sample Input
25 25 3.5------雷达坐标与半径
7----------点数
25 28-------点坐标
23 27
27 27
24 23
26 23
24 29
26 29
350 200 2.0
5
350 202
350 199
350 198
348 200
352 200
995 995 10.0
4
1000 1000
999 998
990 992
1000 999
100 100 -2.5
Sample Output
3
4
4
做法:每个点与中点都组成一个直线方程完后线性规划看其他的点在这条直线左边的inc(s)在右边的inc(b)在直线的inc(m),完后比较m+s与max的大小和b+m与max的大小
代码如下:
#include <iostream>#include <cstdio>#include <cmath>using namespace std;int ry,rx,n,x[10000],y[10000];double r;int main(){ int q,p,t,m,b,s,max; while (~scanf("%d%d%lf",&rx,&ry,&r)&&r>0) { cin>>n; t=0; max=0; for (int i=1;i<=n;i++) { cin>>q>>p; if (sqrt((q-rx)*(q-rx)+(p-ry)*(p-ry))<=r) { t++; x[t]=q; y[t]=p; } } for (int i=1;i<=t;i++) { m=0;b=0;s=0; for (int j=1;j<=t;j++) { if ((y[j]-ry)*(x[i]-rx)-(x[j]-rx)*(y[i]-ry)==0) m++; if ((y[j]-ry)*(x[i]-rx)-(x[j]-rx)*(y[i]-ry)<0) s++; if ((y[j]-ry)*(x[i]-rx)-(x[j]-rx)*(y[i]-ry)>0) b++; } if (b+m>max) max=b+m; if (s+m>max) max=s+m; } cout<<max<<endl; }}
0 0
- ZOJ-1041-Transmitters
- ZOJ 1041Transmitters
- zoj 1041 Transmitters
- zoj 1041 Transmitters
- ZOJ 1041 Transmitters
- ZOJ 1041 Transmitters
- ZOJ 1041Transmitters
- ZOJ 1041 Transmitters(计算几何)
- zoj 1041 || poj 1106 Transmitters
- ZOJ 1041(POJ 1106) Transmitters(…
- zoj 1041 Transmitters 判断一个可以移动的半圆最多可容纳的点的个数
- Transmitters
- zoj1041 Transmitters
- ZOJ1041 Transmitters
- [ZOJ1041] Transmitters
- pku1106 transmitters
- POJ1106-Transmitters
- zoj1041 Transmitters
- 数据结构与算法之排序
- 局域网访问电脑中VMware虚拟机
- SVN项目中常见符号的含义
- Nginx的虚拟主机配置
- 第36篇 Asp.Net源码解析(一)
- ZOJ 1041 Transmitters
- Matlab入门
- http
- 高次方尾数问题
- Codeforces 689D Friends and Subsequences【思维+二分+RMQ】套路题
- java注解
- latex 定理环境,引理,定义,自定义 proof 环境
- (四)顺序串和链串
- 初步了解-集合框架