Codeforces 842B Gleb And Pizza【几何,水】
B. Gleb And Pizza
Gleb ordered pizza home. When the courier delivered the pizza, he was very upset, because several pieces of sausage lay on the crust, and he does not really like the crust.
The pizza is a circle of radius r and center at the origin. Pizza consists of the main part — circle of radius r - d with center at the origin, and crust around the main part of the width d. Pieces of sausage are also circles. The radius of the i -th piece of the sausage is ri, and the center is given as a pair (xi, yi).
Gleb asks you to help determine the number of pieces of sausage caught on the crust. A piece of sausage got on the crust, if it completely lies on the crust.
First string contains two integer numbers r and d (0 ≤ d < r ≤ 500) — the radius of pizza and the width of crust.
Next line contains one integer number n — the number of pieces of sausage (1 ≤ n ≤ 105).
Each of next n lines contains three integer numbers xi, yi and ri ( - 500 ≤ xi, yi ≤ 500, 0 ≤ ri ≤ 500), where xi and yi are coordinates of the center of i-th peace of sausage, ri — radius of i-th peace of sausage.
Output the number of pieces of sausage that lay on the crust.
8 4
7
7 8 1
-7 3 2
0 2 1
0 -2 2
-3 -3 1
0 6 2
5 3 1
2
10 8
4
0 0 9
0 0 10
1 0 1
1 0 2
0
Below is a picture explaining the first example. Circles of green color denote pieces of sausage lying on the crust.

题目链接:http://codeforces.com/contest/842/problem/B
分析:根据圆心到原点的距离这个东西判断一下圆在不在那个环里面就好
下面给出(Python 3.5.2)AC代码:
r,d=map(int,input().split())
n=int(input())
k=0
for i in range(n):
x,y,w=map(int,input().split())
l=(x**2+y**2)**(1/2)
if l-w>=r-d and l+w<=r:
k+=1
print(k)
Codeforces 842B Gleb And Pizza【几何,水】的更多相关文章
- Gleb And Pizza CodeForces - 842B
CodeForces - 842B #include<bits/stdc++.h> using namespace std; int main() { int r,d,t; double ...
- Codeforces Round #430 B. Gleb And Pizza
Gleb ordered pizza home. When the courier delivered the pizza, he was very upset, because several pi ...
- 【Codeforces Round #430 (Div. 2) B】Gleb And Pizza
[链接]点击打开链接 [题意] 在这里写题意 [题解] 根据圆心到原点的距离这个东西判断一下圆在不在那个环里面就好 [错的次数] 0 [反思] 在这了写反思 [代码] #include <cst ...
- Educational Codeforces Round 7 B. The Time 水题
B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...
- Educational Codeforces Round 7 A. Infinite Sequence 水题
A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the ...
- Codeforces Testing Round #12 A. Divisibility 水题
A. Divisibility Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/probl ...
- Codeforces Beta Round #37 A. Towers 水题
A. Towers 题目连接: http://www.codeforces.com/contest/37/problem/A Description Little Vasya has received ...
- codeforces 712B B. Memory and Trident(水题)
题目链接: B. Memory and Trident time limit per test 2 seconds memory limit per test 256 megabytes input ...
- codeforces 712A A. Memory and Crow(水题)
题目链接: A. Memory and Crow time limit per test 2 seconds memory limit per test 256 megabytes input sta ...
随机推荐
- SQL Server 服务器主体拥有一个或多个端点无法删除;错误15141
一.问题描述 当前数据库实例之前已经加入过一个域环境同时也是alwayson集群的一个副本,现在已经退出了以前的域加入一个新域,而且配置的数据库启动服务的域用户和密码和之前的一样.重新使用之前已经存在 ...
- C#创建对象时各种初始化属性、字段的方式的执行顺序
创建对象代码如下: new FilterInfo(Student.CreateTimeProperty,"朱七",Express.Equals,Relationship.Or) { ...
- Jstree 使用CheckBox插件 选中父节点时被禁用的子节点也会选中问题
问题描述: 最近用jstree遇到一个问题,使用CheckBox插件时,当父节点选中时,被禁用的子节点也会选中如下 解决方案: 1. 将jstree升级到最新的版本,v3.3.4及以上就可以 2. ...
- HDU4992 求所有原根
Primitive Roots Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)T ...
- rabbitmq 启动报错
=============================================== 2017/10/24_第1次修改 ccb_warlock = ...
- Qt个人研究进展
1:纯socket通信实现多线程邮件发送,支持多个收件人和附件,通用任何平台,包括ARM.2:纯串口通信AT命令实现多线程短信收发,支持多个收件人和长短信,通用任何平台,包括ARM.3:纯串口通信PO ...
- windows 安装Mysql压缩包
1.将mysql压缩包解压至选定目录下 2.修改my-default.ini文件的以下内容 basedir = E:\develope_software\MySQL\mysql-advanced-5. ...
- JavaScript的DOM编程--09--节点的替换
节点的替换: 1). replaceChild(): 把一个给定父元素里的一个子节点替换为另外一个子节点 var reference = element.replaceChild(newChild,o ...
- 实现Windows程序的数据更新
枚举是一组描述性的名称定义一组有限的值,不包含方法对可能的值进行约束枚举是一组指定的常数,对可能的值进行约束枚举使用时直观方便.更易于维护 pictureBox控件属性名称 说明image ...
- C程序设计语言(第二版)--- 习题选
1. 解: 2. 解: 3. (分析的好有条理啊!) 4. 解: