Gym - 100781G-Goblin Garden Guards
题目链接:https://nanti.jisuanke.com/t/28882
解题思路:单纯的判断点是否在圆内,一一遍历圆外切正方形内的点即可,注意,该题要建个结构体数组存每个地精的位置,再bool个map数组用来标记点是否在圆内,map数组不能用int否则会超内存。
#include<iostream>
using namespace std;
int n,m,ans;
bool map[][];
int in(int x,int y)
{
if(x<||x>||y<||y>)
return ;
else return ;
}
struct node{
int x,y;
}a[];
int main()
{
cin>>n;
for(int i=;i<n;i++)
{
cin>>a[i].x>>a[i].y;
map[a[i].x][a[i].y]=;
}
cin>>m;
for(int i=;i<m;i++)
{
int x,y,r;
cin>>x>>y>>r;
for(int j=x-r;j<=x+r;j++)
{
for(int k=y-r;k<=y+r;k++)
{
if(in(j,k))
{
if((j-x)*(j-x)+(k-y)*(k-y)<=r*r)
map[j][k]=;
}
}
}
}
ans=;
for(int i=;i<n;i++)
if(map[a[i].x][a[i].y])
ans++;
cout<<ans<<endl;
return ;
}
Gym - 100781G-Goblin Garden Guards的更多相关文章
- 【扫描线】Gym - 100781G - Goblin Garden Guards
平面上有100000个哥布林和20000个圆,问你不在圆内的哥布林有多少个. 将每个圆从左到右切2r+1次,形成(2r+1)*2个端点,将上端点记作入点,下端点记作出点,再将这些点和那些哥布林一起排序 ...
- Gym - 100781G Goblin Garden Guards (扫描线)
题意: n 只哥布林,每只哥布林都有一个位置坐标. m 个炮台,每个炮台都有一个位置坐标和一个攻击半径. 如果一个哥布林在任何一个炮台的攻击范围内,都会被杀死. 求最后没有被杀死的哥布林的数量. 这题 ...
- Nordic Collegiate Programming Contest 2015 G. Goblin Garden Guards
In an unprecedented turn of events, goblins recently launched an invasion against the Nedewsian city ...
- Nordic Collegiate Programming Contest 2015(第七场)
A:Adjoin the Networks One day your boss explains to you that he has a bunch of computer networks tha ...
- Security Guards (Gym - 101954B)( bfs + 打表 )
题意及思路 题目主要是讲先给出所有guard的位置,再给出所有incidents的位置,求出guard到达每个incident处最小的steps,其中guard每次可以向四周8个方向移动. 思路:对于 ...
- ACM: Gym 100935B Weird Cryptography - 简单的字符串处理
Weird Cryptography Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u ...
- Codeforces Gym 100513G G. FacePalm Accounting
G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513 ...
- Codeforces Gym 100513G G. FacePalm Accounting 暴力
G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513 ...
- Codeforces Gym 100650C The Game of Efil 模拟+阅读题
原题链接:http://codeforces.com/gym/100650/attachments/download/3269/20052006-acmicpc-east-central-north- ...
随机推荐
- 理解OpenShift(2):网络之 DNS(域名服务)
理解OpenShift(1):网络之 Router 和 Route 理解OpenShift(2):网络之 DNS(域名服务) 理解OpenShift(3):网络之 SDN 理解OpenShift(4) ...
- 备份与还原mysql 数据库的常用命令。
一.备份数据: Mysqldump常用命令: mysqldump -u用户名 -p密码 --databases 数据库1 数据库2 > xxx.sql 常见选项: -u: 用户名 -p: 密码 ...
- 【oracle常见错误】oracle监听程序配置/“ORA-12541: TNS: 无监听程序”
问题描述 在用PL/SQL Developer连接Oracle 11g时报错“ORA-12541: TNS: 无监听程序”,如下图所示.可以按照如下的步骤进行解决. 解决方案 监听程序配置 从开始菜单 ...
- 03-封装BeanUtil工具类(javabean转map和map转javabean对象)
package com.oa.test; import java.beans.BeanInfo; import java.beans.IntrospectionException; import ja ...
- psi
purchase 采购sales 销售inventory 库存 outstock/instock/inventory taking outstock/instock/inventory 出库 入库 盘 ...
- django 补充和中间件
配置 from django.conf import settings form组件 from django.forms import Formfrom django.forms import fie ...
- Linux的命令技巧
一.使用apt-get installl 方法安装的库或者程序一般的路径如下 1.下载的软件存放位置 /var/cache/apt/archives 2.安装后软件默认位置 /usr ...
- ubuntu vsftp
转自:https://www.cnblogs.com/java-synchronized/p/6935711.html 12点多了,擦!做个码农真不容易呀! 系统:Ubuntu16.04 安装:FTP ...
- mongo 副本集
副本集配置文件 dbpath=/hwdata/mongodb/datalogpath=/hwdata/mongodb/logs/master.logpidfilepath=/hwdata/mongod ...
- @RestController 与 @Controller @RequestMapping("/") 区别很大
后者可以通过返回字符串,返回到指定路径的html http://localhost:8080/ 这样显示 ,但是仍以get方式请求的. https://www.cnblogs.com/zgqys19 ...