某人有一张圆桌,其中心为(x,y),现在要把桌子中心移到(x1,y1),每次移动一步,都得在圆桌边界固定一个点,然后将桌子围绕这个点旋转,问至少几步可以完成移动?
输入:5个整数r,x,y,x1,y1其中1<=r<=100000,-100000<=x,y,x1,y1<=100000
输入样例:2 0 0 04
输出样例:1
<span style="font-size:18px;">#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
int main()
{
int r, x, y, x1, y1;
cin >> r >> x >> y >> x1 >> y1;
double dis = 0.0;
int d = 2 * r;
dis = sqrt(pow((double)(x1-x),2) + pow((double)(y1 - y),2));
int res = -1;
if(fmod(dis,(double)d)> 0){
res = (int)(dis/d) + 1;
}else{
res = (int)(dis/d);
}
cout << res << endl;
return 0;
}
</span>