BZOJ1338: Pku1981 Circle and Points单位圆覆盖
来源:互联网 发布:matlab和python 编辑:程序博客网 时间:2024/06/13 05:21
提供一个暴力的想法
极大肯定是两个点在圆周上
然后
好吧。。。
其实有个
具体看爱神Blog
http://blog.csdn.net/acm_cxlove/article/details/7894310
#include<cstdio>#include<iostream>#include<cmath>#include<cstring>#include<algorithm>using namespace std;constdouble r=1;const double pi=acos(-1);const double eps=1e-7;struct Circle{ double x,y; inline void get(){scanf("%lf%lf",&x,&y);}}P[100001];#define abs(a) ((a)<0?(-(a)):(a))struct Pair{ double bg; int ed; inline friend bool operator <(Pair a,Pair b){return a.bg<b.bg||(abs(a.bg-b.bg)<eps&&a.ed<b.ed);} }Cache[100001];inline double dis(Circle a,Circle b){return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}int main(){ while(true) { int n,tot,ans=0; scanf("%d\n",&n); if(n==0)return 0; for(int i=1;i<=n;i++)P[i].get(); for(int i=1;i<=n;i++) { tot=0; for(int j=1;j<=n;j++) if(i^j) { double D=dis(P[i],P[j]); if(D>2.0)continue; double T=atan2(P[j].y-P[i].y,P[j].x-P[i].x); T=T<0?T+2*pi:T; double Pt=acos(D/2.0); Cache[++tot]=(Pair){T-Pt+2*pi,false}; Cache[++tot]=(Pair){T+Pt+2*pi,true}; } int sum=0; sort(Cache+1,Cache+1+tot); for(int i=1;i<=tot;i++) if(Cache[i].ed)sum--; else ans=max(ans,++sum); } printf("%d\n",ans+1); } return 0;}
0 0
- BZOJ1338: Pku1981 Circle and Points单位圆覆盖
- bzoj1338: Pku1981 Circle and Points单位圆覆盖
- [极大化 极角排序] POJ 1981 Circle and Points & BZOJ 1338 Pku1981 Circle and Points单位圆覆盖
- Circle and Points----单位圆覆盖最多点
- JOJ 2109 && POJ 1981 Circle and Points 计算几何 单位圆覆盖问题
- POJ 1981 Circle and Points(单位圆覆盖n^3&&n^2lgn)
- poj 1981 Circle and Points(圆覆盖点问题)
- POJ1981Circle and Points【单位圆能覆盖的最多点】
- poj 1981 Circle and Points(固定半径的圆能覆盖的最多点数)
- POJ 1981 Circle and Points
- POJ 1981 Circle and Points(求半径R圆覆盖最多点数及由圆上两点和半径求圆心)
- zoj 2167 || poj 1981 Circle and Points
- 【计算几何】 POJ 1981 Circle and Points
- POJ 1981 Circle and Points 计算几何
- POJ 1981 Circle and Points 已翻译
- POJ1981 Circle and Points(计算几何)
- poj1981 Circle and Points 计算几何
- poj 1981 Circle and Points (模板)
- 训练深度神经网络的时候需要注意的技巧
- XDU-1138 Z1+Z2 (水~复数相加) From 西电校赛网络赛
- 庖丁解牛之仿《闪传》实现文件传输(中)
- "软件包 opera-stable 需要重新安装,但是我无法找到相应的安装文件 " 解决办法
- android Gradle的神奇之处
- BZOJ1338: Pku1981 Circle and Points单位圆覆盖
- 盒子模型补充知识汇总
- XDU-1139 猴子吃桃 II (水~斐波那契数列求和) From 西电校赛网络赛
- 微软面试题:五个囚犯抓绿豆
- 【C++】文件读写
- Android 从网络加载图片
- The Lucky Week
- Category 动态添加属性
- Android下拉刷新