CF420E.Playing the ball

普及/提高-

通过率:0%

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 dd 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 2d2·d from the player's original position and so on (it continue flying in the chosen direction and hitting the plane after each dd units). All coders in the F company are strong, so the ball flies infinitely far away.

The plane has nn 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 xx times during the move, the player also gets xx 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 — nn и dd (1<=n<=2104; 5<=d<=10)(1<=n<=2·10^{4}; 5<=d<=10) . Next nn lines contain the circles' description. The ii -th line contains three space-separated integers xix_{i} , yiy_{i} , rir_{i} (10000<=xi,yi<=10000; 1<=r<=50)(-10000<=x_{i},y_{i}<=10000; 1<=r<=50) , where (xi,yi,ri)(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
    
首页