极角排序扫一圈。

今天没什么状态写个水题减轻负罪感(大雾)

 #include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
typedef double db;
const db eps = 1e-;
const db pi = acos(-);
int sign(db k){
if (k>eps) return ; else if (k<-eps) return -; return ;
}
int cmp(db k1,db k2){return sign(k1-k2);}
struct point{
db x,y,ang;
point operator + (const point &k1) const{return (point){k1.x+x,k1.y+y};}
point operator - (const point &k1) const{return (point){x-k1.x,y-k1.y};}
point operator * (db k1) const{return (point){x*k1,y*k1};}
point operator / (db k1) const{return (point){x/k1,y/k1};}
int operator == (const point &k1) const{return cmp(x,k1.x)==&&cmp(y,k1.y)==;}
db abs(){ return sqrt(x*x+y*y);}
db dis(point k1){return ((*this)-k1).abs();}
db getw(){return atan2(y,x);}
};
struct circle{
point o;db r;
int inside(point k){return cmp(r,o.dis(k))>=;}
}c;
vector<point> v;
bool cmp2(point a,point b){
return a.ang<b.ang;
}
int n;point t;
int main(){
while (scanf("%lf%lf%lf",&c.o.x,&c.o.y,&c.r)&&c.r>){
//scanf("%lf%lf%lf",&c.o.x,&c.o.y,&c.r);
scanf("%d",&n);
while (n--){
scanf("%lf%lf",&t.x,&t.y);
if(c.inside(t)){
t.ang = (c.o-t).getw();
v.push_back(t);
v.push_back({t.x,t.y,t.ang+*pi});
}
}
sort(v.begin(),v.end(),cmp2);
int m = v.size()/;
int ans = ;
for(int l=,r=;l<m;l++){
while (r<*m&&v[r].ang-v[l].ang<=pi)
r++;
ans=max(ans,r-l);
}
printf("%d\n",ans);
v.clear();
}
}

poj1106的更多相关文章

  1. 【解题报告】POJ-1106 Transmitters

    原题地址:http://poj.org/problem?id=1106 题目大意: 给定一些平面的点以及一个圆心和半径,过圆心作一个半圆,求点在半圆中点最多多少个. 解题思路: 首先将给定点中和圆心的 ...

  2. poj1106 Transmitters

    地址:http://poj.org/problem?id=1106 题目: Transmitters Time Limit: 1000MS   Memory Limit: 10000K Total S ...

随机推荐

  1. DirectX11 With Windows SDK--18 使用DirectXCollision库进行碰撞检测

    前言 在DirectX SDK中,碰撞检测的相关函数位于xnacollision.h中.但是现在,前面所实现的相关函数都已经转移到Windows SDK的DirectXCollision.h中,并且处 ...

  2. H5取经之路——CSS基础语法

    一.CSS常用选择器 [选择器的命名规则] * 1.只能有字母数字下划线组成,不能有其他任何字符 * 2.开头不能是数字 [通用选择器] * 1.写法:*{} * 2.选中页面中的所有标签 * 3.优 ...

  3. webpack学习笔记——publicPath路径问题

    output: { filename: "[name].js", path:path.resolve(__dirname,"build") } 如果没有指定pu ...

  4. 基于vue cli 3.0创建前端项目并安装cube-ui

    前提条件: 安装node.js. 国内的开发者最好先配置淘宝镜像. 之后用cnpm来代替npm命令. 项目创建过程: 打开cmd,输入命令进入目标工作空间,以本机项目为例: cd /d d: cd D ...

  5. 个人经验~ 利用5.7的sys库更好的排查问题

    一 简介:今天我们讲讲如何利用5.7的sys新库进行问题的排查二 描述   1 Sys库所有的数据源来自:performance_schema和information_schema.目标是把perfo ...

  6. HTTP报错401和403详解及解决办法

    一.401: 1. HTTP 401 错误 - 未授权: (Unauthorized) 您的Web服务器认为,客户端发送的 HTTP 数据流是正确的,但进入网址 (URL) 资源 , 需要用户身份验证 ...

  7. sql server的sysobjects表中xtype字段值的含义

    xtype字段包含的值的意思如下: AF = Aggregate function (CLR) 聚合函数(CLR)  C = CHECK constraint CHECK约束  D = Default ...

  8. 【easy】202. Happy Number

    happy number Write an algorithm to determine if a number is "happy". A happy number is a n ...

  9. $Django python中使用redis, django中使用(封装了),redis开启事务(管道)

    一 Python操作Redis之普通连接 #先安装 pip3 install redis import redis r = redis.Redis(host='127.0.0.1', port=637 ...

  10. 【原创】Linux基础之挂载硬盘

    1 查看哪些硬盘没有挂载 # fdisk -l Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 sectorsUnits = sector ...