Safest Buildings ZOJ - 3993(计算几何+思维)

初级文章【西门子】字符拼接成字符串 针对S7-400极其以下PLC,1200往上据说有专门的块了呢,首先,我是不用库的,需要什么函数会自己写,OK进入正题。 首先,我们有一个DB块,里面有14个char,一个14位的char数组和一个14位的string。如下图。 我们的目的是将char1-char10拼接成一个string。 第一种方式:第一步,将char放进数组。 ​​​​​​​ 相信大家都能看明白,但是我还是要解释解释 L取值2 T赋值到临时变量DBNO(INT) OPN DB [#DBNO]获取DB块,这一句. 阅读详情

Safest Buildings ZOJ - 3993

PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for weapons and equipment to kill others while avoiding getting killed themselves. BaoBao is a big fan of the game, but this time he is having some trouble selecting the safest building.

There are buildings scattering on the island in the game, and we consider these buildings as points on a two-dimensional plane. At the beginning of each round, a circular safe area whose center is located at (0, 0) with radius will be spawned on the island. After some time, the safe area will shrink down towards a random circle with radius (). The whole new safe area is entirely contained in the original safe area (may be tangent to the original safe area), and the center of the new safe area is uniformly chosen within the original safe area.

The buildings covered by the new safe area is called the safe buildings. Given the radius of the safe areas and the positions of the buildings, BaoBao wants to find all the buildings with the largest probability to become safe buildings.
Input

There are multiple test cases. The first line of input contains an integer , indicating the number of test cases. For each test case:

The first line contains three integers (), and (), indicating the number of buildings and the radius of two safe circles.

The following lines each contains 2 integers and (), indicating the coordinate of the buildings. Here we assume that the center of the original safe circle is located at , and all the buildings are inside the original circle.

It’s guaranteed that the sum of over all test cases will not exceed 5000.
Output

For each test case output two lines.

The first line contains an integer , indicating the number of buildings with the highest probability to become safe buildings.

The second line contains integers separated by a space in ascending order, indicating the indices of safest buildings.

Please, DO NOT output extra spaces at the end of each line.
Sample Input

2
3 10 5
3 4
3 5
3 6
3 10 4
-7 -6
4 5
5 4

Sample Output

1
1
2
2 3
题意:

原本有一个半径为R的圆形的圈,圈里面是安全区域,大圈内部有一些建筑物,给定这些建筑物的坐标,现在给定一个半径为r(r≤Rr\le Rr≤R)的小圈,圆心可以为大圈内的任意一点,这样小圈变成缩小后的安全区域,问缩小范围后,仍然处在安全区域的概率最大的建筑物是啥,输出个数和每个建筑物的编号

分析:

大致应该分为两种情况:

一、 当小圆的直径2r小于大圆的半径R的时候,对于一个点而言,它所处的所有可能的安全区域,应该是让这个点在小圆的边上,然后小圆绕这个点转一圈所得到的中等圆,此圆的半径为2r
如图所示
在这里插入图片描述
那么这个时候的边界条件就是图中红色圆与大圆想内切的时候,绿圈表示的是点可以在的边界范围,因为在这个范围上以及在这个范围内,任意点的所有安全区域都可以构成一个图中红色的中等圆,因此只需要比较半径和圆心距即可,设点到圆心的距离为dis,所以只需要比较如果R-dis>=2r说明这里面的点都是等可能安全的并且都是安全可能性最大,否则再灰色区域的点,一定无法构成一个完整的红色圆,安全可能性就小,如果绿色圈内没有点,就选取里圆心近的点,越近越好。

二、如果小圆直径2r大于大圆的半径R,此时如果让小圆内切着大圆转一圈,那么中心一定可以有个圆形区域,它始终包含,那么这个区域内的点,就是可能性最大的点,所以只需要判断是否在这个区域即可,判断是否在这个区域仍然是比较距离

在这里插入图片描述
图中绿色区域就是安全性最大的区域,即无论小圆怎么转始终会包括的公共区域,那么根据图可以知道只要dis+R<=2r即可,同理如果没有,就选择离圆心越近越好

code:

#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
struct node{
    int x,y,id;
    double dis;
    bool operator < (const node & a)const{
        return dis < a.dis;
    }
}p[110];
vector<int> vec;

int main(){
    int T;
    scanf("%d",&T);
    while(T--){
        vec.clear();
        int n,R,r;
        scanf("%d%d%d",&n,&R,&r);
        for(int i = 1; i <= n; i++){
            scanf("%d%d",&p[i].x,&p[i].y);
            p[i].dis = sqrt(1.0 * p[i].x * p[i].x + 1.0 * p[i].y * p[i].y);
            p[i].id = i;
        }
        sort(p+1,p+1+n);
        if(R > 2 * r){
            for(int i = 1; i <= n; i++){
                if(R - p[i].dis >= 2.0 * r)
                    vec.push_back(p[i].id);
            }//找范围内的点
            if(vec.size() == 0){//如果范围内没有,有找离圆心距离最近的点
                double t = p[1].dis;
                for(int i = 1; i <= n; i++){
                    if(t == p[i].dis)
                        vec.push_back(p[i].id);
                }
            }
        }
        else{
            for(int i = 1; i <= n; i++){
                if(p[i].dis + R <= 2.0 * r)
                    vec.push_back(p[i].id);
            }
            if(vec.size() == 0){
                double t = p[1].dis;
                for(int i = 1; i <= n; i++){
                    if(t == p[i].dis)
                        vec.push_back(p[i].id);
                }
            }
        }
        sort(vec.begin(),vec.end());
        printf("%d\n",vec.size());
        for(int i = 0; i < vec.size(); i++){
            printf("%d%c",vec[i],i == vec.size() - 1 ? '\n' : ' ');
        }
    }
    return 0;
}

Vue3 - [兼容PC和手机H5] 详细监听浏览器刷新 / 关闭 / 前进后退事件,用户点击关闭和刷新页面前 “拦截“ 操作并弹出提示框(实时监听用户关闭或刷新网页,触发时文字提醒并执行自定义操作) vue3监听页面关闭和刷新,vue3中如何监听页面刷新和关闭事件,vue3中监听浏览器窗口关闭事件,并在窗口关闭进行操作,vue3怎么只在某个页面监听,其他页面不监听,vue3监听刷新和关闭怎么离开页面时注销释放,vue3怎么阻止浏览器前进和后退并提示,页面跳转离开后依旧可以监听到刷新和关闭,vue3怎么知道用户关闭了网页,vue3如何监听刷新网页操作并截断,vue3移动端手机h5网页手机网站监听浏览器刷新关闭,vue3当页面关闭或刷新时怎么提示用户离开不保存数据,vue3项目监听浏览器窗口或标签页关闭,并 阅读详情

相关推荐

Aloudata Agent :基于 NoETL 明细语义层的分析决策智能体

这是包括我们在内的一些厂商探索的一个新方向,这种方式先由大模型将自然语言转化为对指标语义层的查询请求(MQL,Metrics Query Language),再由指标平台将指标和维度的查询与计算逻辑转化为准确的 SQL 查询语句。用户查询经大模型语义解析后,将其转换为指标、维度及筛选条件的组合表达,并生成面向指标平台的 MQL,Aloudata CAN 指标平台的语义引擎将 MQL 转换为准确和可执行的查询 SQL,语义引擎内置函数体系与 SQL 解析器,确保语义转换的 100% 准确性。

Aloudata的博客 1663

ZOJ - 3993(思维)

Safest Buildings题目传送门 题意:吃鸡游戏,给出初始圈半径以及圈内的建筑,给你下一个圈的半径r(圈被要求在初始圈内),求最大概率为安全建筑的建筑有那几个。 思路:很简单可以知道,离中心越近越有可能,但事实上在某些范围内概率是相同的当r足够大或者足够小。我们把初始圈叫做大圆,下一个圈为小圆。当2*r大于R时,小圆内切大圆转一圈,可以发现以2*r-R为半径,以原圆心为圆心的圆内的点的

siyu 1032

Shopee商品详情页反爬实战:手把手逆向x-sap-Ri和x-sap-Sec请求头加密

本文详细解析了Shopee商品详情页反爬机制中x-sap-Ri和x-sap-Sec请求头参数的加密逻辑,通过JS逆向技术手把手教你定位加密入口、分析哈希算法与对称加密实现,并提供完整实战案例和应对反爬策略的高级技巧,助力开发者突破电商平台数据采集难点。

weixin_27875131的博客 1823

Safest Buildings(思维模拟)

ZOJ - 3993 PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for weapons and equipment to kill others while avoiding ...

蒟蒻的博客 463

STM32F407+LAN8720A+LwIP实战:FreeModbus TCP从机功能开发指南

本文详细介绍了基于STM32F407和LAN8720A硬件平台,结合LwIP协议栈实现FreeModbus TCP从机功能的开发指南。内容涵盖硬件连接、LwIP移植、FreeModbus TCP从机实现、任务调度及调试技巧,为工业控制领域的以太网通信开发提供实用参考。

weixin_29190651的博客 546

AppStore逆向分析:从网络抓包到自动化模拟的完整实践

在移动应用生态中,理解客户端与服务器之间的通信协议是进行自动化测试、数据分析和系统集成的关键技术基础。通过分析网络请求与响应,可以深入理解认证、会话管理和数据交换的原理,这对于构建稳定的自动化流程至关重要。其技术价值在于能够实现合法场景下的流程模拟,例如应用元数据监控、沙盒环境测试或内部工具开发。在实际应用场景中,开发者常需处理登录态维持、请求签名验证及风控策略应对等挑战。本文聚焦于AppStore这一封闭生态,详细拆解了其登录、查询等核心环节的通信机制,并探讨了使用Python结合抓包工具进行安全逆向分析

weixin_42524171的博客 926

CCPC秦皇岛 ZOJ3993 Safest Buildings(半径比较/圆的相交面积)

PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for weapons and equipment to kill others while avoiding getting killed themselves. BaoBao is a big fan of the game, but this

nka_kun的博客 1437

宝塔面板添加站点及运营商SSL免费证书的申请与使用

本文详细介绍在宝塔面板下如何正确添加站点、配置站点,及在运营商如何申请免费SSL证书,将其配置到宝塔站点里。 给你的网站加一把锁,教你免费SSL证书申请,配置到自己的网站中。 环境:Ubuntu server 18 工具:宝塔控制面板 平台:阿里云 Web服务器:Nginx 宝塔:https://www.bt.cn/ 阿里云:https://www.aliyun.com/ 腾讯云:https://cloud.tencent.com/ 要求: 1.宝塔控制面板搭建完毕。 2掌握域名解析的原理。 3.了解ht

贺兰山长老 5058

ZOJ - 3993 - Safest Buildings(概率,分类讨论)

Safest Buildings Time Limit: 1 Second      Memory Limit: 65536 KB PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and sca

vloai 635

拆解大疆M300电池BMS:基于TI TIDA-010030方案的硬件架构深度分析

本文深度解析了大疆M300无人机电池管理系统(BMS)基于TI TIDA-010030参考设计的硬件架构。通过对比TI方案与大疆实现的差异,详细介绍了BQ7694003监控前端和BQ34Z100电量计的优化设计,以及通信架构的可靠性改进。文章还揭示了大疆在成本、空间和标准化方面的工程妥协与创新平衡,为锂电池保护方案提供了实践参考。

weixin_27066963的博客 237

【RKNN】RKNN-Toolkit2 Python API函数详解

RKNN-Toolkit2 的 API 设计以开发者效率为核心,覆盖模型转换、量化、部署全流程。通过灵活的参数配置(如多核调度、混合量化)和调试工具(性能分析、精度对比),可快速适配复杂边缘场景。

浩瀚之水的专栏 786

ZOJ-3993 Safest Buildings

题意:在一个半径为R的大圈里会随机的刷出半径为r的安全区,这个小圆(半径r)一定在大圆内(半径R),给n个建筑物,要求输出安全率最高的建筑的数目和编号 思路:  第一点:以每一个建筑为圆心,以r为半径作一个圆O1,这个圆O1内或者圆上的点都可以它本身为圆心,以r为半径作一个圆O2使这个建筑在这个圆O2内(安全区内),所以题目可以转化为 看哪个建筑的圆O1的面积大。如图A,B两个建筑物,明显A的圆...

Cworld2017的博客 331

图机器学习(9)——图正则化算法

网络信息能够有效约束模型行为,确保相邻节点的输出保持平滑过渡——这种特性在半监督场景中尤其重要,可实现未标注节点的信息传播。更进一步,这种机制也可用于正则化学习过程,从而提升模型在未见样本上的泛化能力。在本节中,我们探讨了在学习阶段应用正则化技术的方法,用于显著提升模型的鲁棒性,使其具备更优异的泛化能力。

盼小辉丶的博客 8915

2017 秦皇岛CCPC M题 Safest Buildings(概率+思维+计算几何)

题意: 题目说的是一个叫“吃鸡”的游戏。 给出两个半径R,r,R表示第一次的大圈半径,r表示第二次的小圈半径。第一次大圈的圆心位于(0,0),第二次小圈的圆心未知,但在大圈内,给你一个n,然后给出n个屋子的位置,问这些屋子中,第二次在小圈的概率最大的屋子有几个,都是哪些。 思路: 首先分析到如果小圈是一个很小很小的圈,那么靠近原点的区域的这些点的概率是一样的,因为都可以使小圈360度绕着这

protecteyesight的博客 2470

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

ccpc秦皇岛zoj3993 -比较圆内点覆盖概率

PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for weapons and equipment to kill others while avoiding getting kille

mystical_curve的博客 462

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

ZOJ - 3993 Safest Buildings (2017CCPC秦皇岛站 简单题)

Safest Buildings Time Limit: 1 Second      Memory Limit: 65536 KB PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and sca

LP_Cong 829

ZOJ 3993 && 2017CCPC秦皇岛 M:Safest Buildings

题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3993 题意: 给你一个圆心为(0, 0),半径为R的大圈,里面有n个点 之后在大圈中随机生成一个半径为r的小圈,满足r 问哪些点在小圈中的概率最高 思路: 三种情况: ①2*r>=R,有些点一定会在小圈中,概率为100%,如果这个范围

加载中... 711

Safest Buildings (思维)

链接:https://ac.nowcoder.com/acm/problem/14377 来源:牛客网 PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for weapons ...

weixin_44757834的博客 433

ZOJ-Safest Buildings

Safest Buildings PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for...

1479

ZOJ 3993(2017CCPC秦皇岛站M题)Safest Buildings

题目连接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3993 题目大意:        最初的防御战是以(0,0)为圆形R为半径的一个圆O1,问你当防御战缩小为最初的圆O1内的一个半径为r的小圆(小圆的圆心随意位置)时,各点的能在小圆内的概率最大的是哪个。 题目思路:       AC代码: #inclu

syz201558503103的博客 500

ZOJ-3993(概率转化为面积问题)

**题目:**PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for weapons and equipment to kill others while avoiding gettin

行云出岫 809

ZOJ 3993 Safest Buildings(概率 数学)

DescriptionPUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for weapons and equipment to kill others while avoiding ge

so_so_y的博客 534

G - Safest Buildings(数学几何题)

PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for weapons and equipment to kill others while avoiding getting kill...

zhiyeegao的博客 1万+

2017CCPC秦皇岛现场赛 - M - Safest Buildings 【几何 + 思维】

Safest BuildingsTime Limit: 1 Second Memory Limit: 65536 KBPUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for w

nobleman 1463

ZOJ3993 半径比较/圆的相交面积

Safest BuildingsTime Limit: 1 Second      Memory Limit: 65536 KBPUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for ...

qq_36876305的博客 240

Safest Buildings ZOJ - 3993 (几何问题)

PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for weapons and equipment to kill others while avoiding getting kill...

zx93的博客 392

[CCPC2017 秦皇岛] ZOJ 3993 面积概率 + 计算几何(求两圆面积交)

CCPC训练赛第一场做到的题目,看了网上好多大佬的写法发现和我写的不是很相同,可能是我比较水,只能写比较暴力的做法。 题目描述 PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge ...

森世 291
上一篇: Numbers ZOJ - 3987(二进制思维+贪心)
下一篇: Balloon Robot ZOJ - 3981(思维)
Guuuuuu老师儿
博客等级 码龄9年 259粉丝 718原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值