Amr loves Geometry. One day he came up with a very interesting problem.

Amr has a circle of radius r and center in point (x, y). He wants the circle center to be in new position (x', y').

In one step Amr can put a pin to the border of the circle in a certain point, then rotate the circle around that pin by any angle and finally remove the pin.

Help Amr to achieve his goal in minimum number of steps.

Input

Input consists of 5 space-separated integers rxyxy' (1 ≤ r ≤ 105,  - 105 ≤ x, y, x', y' ≤ 105), circle radius, coordinates of original center of the circle and coordinates of destination center of the circle respectively.

Output

Output a single integer — minimum number of steps required to move the center of the circle to the destination point.

Examples
input
2 0 0 0 4
output
1
input
1 1 1 4 4
output
3
input
4 5 6 5 6
output
0
Note

In the first sample test the optimal way is to put a pin at point (0, 2) and rotate the circle by 180 degrees counter-clockwise (or clockwise, no matter).

 #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll gcd(ll a,ll b){
return b?gcd(b,a%b):a;
}
bool cmp(int x,int y)
{
return x>y;
}
const int N=;
const int mod=1e9+;
int a[];
int main()
{
std::ios::sync_with_stdio(false);
double r,x,y,x1,y1;
while(scanf("%lf%lf%lf%lf%lf",&r,&x,&y,&x1,&y1)!=EOF){
double dis=sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
double d=*r;
int cnt=dis/d;
if(cnt*d<dis)
cnt++;
printf("%d\n",cnt);
}
return ;
}

Codeforce 507B - Amr and Pins的更多相关文章

  1. Codefores 507B Amr and Pins

    B. Amr and Pins time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  2. CodeForces - 507B - Amr and Pins(计算几何)

    Amr loves Geometry. One day he came up with a very interesting problem. Amr has a circle of radius r ...

  3. codeforces 507B. Amr and Pins 解题报告

    题目链接:http://codeforces.com/problemset/problem/507/B 题目意思:给出圆的半径,以及圆心坐标和最终圆心要到达的坐标位置.问最少步数是多少.移动见下图.( ...

  4. CF Amr and Pins (数学)

    Amr and Pins time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  5. Codeforces Round #287 (Div. 2) B. Amr and Pins 水题

    B. Amr and Pins time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  6. codeforcfes Codeforces Round #287 (Div. 2) B. Amr and Pins

    B. Amr and Pins time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  7. CF 287(div 2) B Amr and Pins

    解题思路:一开始自己想的是找出每一次旋转所得到的圆心轨迹,将想要旋转到的点代入该圆心轨迹的方程,如果相等,则跳出循环,如果不相等,则接着进行下一次旋转.后来看了题解,发现,它的旋转可以是任意角度的,所 ...

  8. CodeForces Round #287 Div.2

    A. Amr and Music (贪心) 水题,没能秒切,略尴尬. #include <cstdio> #include <algorithm> using namespac ...

  9. ffmpeg常用转换命令,支持WAV转AMR

    音频转换: 1.转换amr到mp3: ffmpeg -i shenhuxi.amr amr2mp3.mp3 2.转换amr到wav: ffmpeg -acodec libamr_nb -i shenh ...

随机推荐

  1. Fast-R-CNN

    基于R-CNN和SPP-Net思想,RBG提出了Fast-R-CNN算法.如果选用VGG16网络进行特征提取,在训练阶段,Fast-R-CNN的速度相比RCNN和SPP-Net可以分别提升9倍和3倍: ...

  2. vue.js安装问题

    1.安装:npm install --global vue-cli 2.创建项目:vue init webpack my-project npm WARN deprecated browserslis ...

  3. [sh]basename&dirname截取路径和文件名&case参数选项

    给出全路径,取出路径和文件名 basename使用示例 http://codingstandards.iteye.com/blog/840784 示例一 [root@web ~]# basename ...

  4. [py]python __file__ 与argv[0]

    http://andylin02.iteye.com/blog/933237 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__ ...

  5. SaltStack 数据系统 Grains Pillar

    grains 先来一个很好用的命令 # salt '*' grains.items \\基本上输出了所有你想要的信息 192.168.100.138: ---------- SSDs: biosrel ...

  6. 【LeetCode每天一题】Add Two Numbers(两链表相加)

    You are given two non-empty linked lists representing two non-negative integers. The digits are stor ...

  7. 如何用Win7远程链接ubuntu14.04桌面

    如何用Win7远程链接ubuntu14.04桌面 采用vnc技术 参考:http://blog.csdn.net/hnjztyx/article/details/69739137

  8. java json Gson

    引入 Gson 到 pom.xml <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --> <de ...

  9. Golang package

    今天,灵感一现:不能一个文件干到底吧,那要是工程大了怎么办? 答案很简单,“包”啊 GO里的包,看起来很简单,但又不简单 一开始,我想当然的以为就是include 路径一样的问题 事实是,GO以GOP ...

  10. iOS 新浪微博-3.0 新特性

    每个程序在第一次启动的时候,都会显示新特性.效果如下: 思路: 添加一个ViewController,里面放两个View,一个是UISrollView,另一个pageControl 往UISrollV ...