A9385 | Playing the ball
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
A coder cannot sit and code all day. Sometimes it is a good idea to rise from the desk, have a rest, have small talk with colleagues and even play. The coders of the F company have their favorite ball game.
Let's imagine the game on the plane with a cartesian coordinate system. The point (0, 0) contains the player who chooses an arbitrary direction and throws a ball in that direction. The ball hits the plane at distance $d$ from the player's original position and continues flying in the same direction. After the ball hits the plane for the first time, it flies on and hits the plane again at distance $2·d$ from the player's original position and so on (it continue flying in the chosen direction and hitting the plane after each $d$ units). All coders in the F company are strong, so the ball flies infinitely far away.
The plane has $n$ circles painted on it. If a ball hits the plane and hits a circle that is painted on the plane (including its border), then the player gets one point. The ball can hit multiple circles at once and get one point for each of them (if the ball hits some circle $x$ times during the move, the player also gets $x$ points). Count the maximum number of points a player can get if he throws a ball in the arbitrary direction. Note that the direction may have real cooridinates.
Let's imagine the game on the plane with a cartesian coordinate system. The point (0, 0) contains the player who chooses an arbitrary direction and throws a ball in that direction. The ball hits the plane at distance $d$ from the player's original position and continues flying in the same direction. After the ball hits the plane for the first time, it flies on and hits the plane again at distance $2·d$ from the player's original position and so on (it continue flying in the chosen direction and hitting the plane after each $d$ units). All coders in the F company are strong, so the ball flies infinitely far away.
The plane has $n$ circles painted on it. If a ball hits the plane and hits a circle that is painted on the plane (including its border), then the player gets one point. The ball can hit multiple circles at once and get one point for each of them (if the ball hits some circle $x$ times during the move, the player also gets $x$ points). Count the maximum number of points a player can get if he throws a ball in the arbitrary direction. Note that the direction may have real cooridinates.
输入格式
The first line contains two space-separated integers — $n$ и $d$ $(1<=n<=2·10^{4}; 5<=d<=10)$ . Next $n$ lines contain the circles' description. The $i$ -th line contains three space-separated integers $x_{i}$ , $y_{i}$ , $r_{i}$ $(-10000<=x_{i},y_{i}<=10000; 1<=r<=50)$ , where $(x_{i},y_{i},r_{i})$ are the coordinates of the center and the radius of the circle, correspondingly. The point (0, 0) is not inside or on the border of some circle.
输出格式
Print a single integer — the maximum number of points you can get.
输入输出样例
输入 #1
2 5 1 1 1 5 0 1
输出 #1
1
输入 #2
2 5 4 0 3 5 3 1
输出 #2
2
输入 #3
1 10 20 0 10
输出 #3
3
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted