CF420E.Playing the ball
省选/NOI-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
程序员不能整天坐着编程。有时,离开座位休息一下、与同事闲聊几句,甚至玩一玩,都是不错的选择。F 公司的程序员们有自己钟爱的球类游戏。
我们来想象一个在平面直角坐标系上的游戏。点 (0,0) 处站着一名玩家,他可任选一个方向,朝该方向投掷一个球。球在距离玩家初始位置 d 处首次击中平面,并继续沿同一方向飞行。球首次击中平面后,继续飞行并在距离玩家初始位置 2⋅d 处再次击中平面,依此类推(即球始终沿选定方向飞行,每前进 d 个单位长度便击中平面一次)。F 公司的所有程序员都很强壮,因此球将无限飞远。
平面上共绘制了 n 个圆。若球在某次击中平面时,恰好落在某个已绘制的圆内或其边界上,则玩家得 1 分。球可能在单次击中时同时命中多个圆,对每个被命中的圆均计 1 分(若球在某次击中过程中命中某个圆 x 次,玩家也获得 x 分)。请计算:当玩家可任意选择投球方向时,所能获得的最大得分。注意:该方向可用实数坐标表示。
输入格式
The first line contains two space-separated integers — n и d (1 ≤ n ≤ 2·104; 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.
第一行包含两个以空格分隔的整数 — n 和 d(1 ≤ n ≤ 2⋅104;5 ≤ d ≤ 10)。接下来的 n 行描述了这些圆。第 i 行包含三个以空格分隔的整数 xi、yi、ri(−10000 ≤ xi, yi ≤ 10000;1 ≤ ri ≤ 50),其中 (xi, yi, ri) 分别表示第 i 个圆的圆心坐标和半径。点 (0,0) 不在任何一个圆的内部或边界上。
输出格式
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
输入解题思路,AI测评打分。不知道怎么写?