#AT1771. C - Compass Walking

C - Compass Walking

C - 指南针行走

得分: $300$ 分

问题描述

高桥站在一个二维平面的原点上。

通过迈出一步,他可以移动到离他当前位置恰好是 $R$ 的欧几里得距离的点(移动的目的地的坐标不一定是整数)。没有其他的移动方式。

计算高桥在到达 $(X, Y)$ 之前所需的最小步数。

请注意,点 $(x_1,y_1)$ 和 $(x_2,y_2)$ 之间的欧几里得距离是 $\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$。

约束条件

  • $1 \leq R \leq 10^5$
  • $0 \leq X,Y \leq 10^5$
  • $(X,Y) \neq (0,0)$
  • 输入中的所有值都是整数。

输入

从标准输入读入数据,输入格式如下:

RR XX YY

输出

打印高桥在到达 $(X, Y)$ 之前所需的最小步数。


5 15 0
3

He can reach there in three steps: $(0,0) \to (5,0) \to (10,0) \to (15,0)$. This is the minimum number needed: he cannot reach there in two or fewer steps.

Figure 1


5 11 0
3

One optimal route is $(0,0) \to (5,0) \to (8,4) \to (11,0)$.

Figure 2


3 4 4
2

One optimal route is $(0,0) \to (2-\frac{\sqrt{2}}{2}, 2+\frac{\sqrt{2}}{2}) \to (4,4)$.

Figure 3