现在有一张半径为r的圆桌,其中心位于(x,y),现在他想把圆桌的中心移到(x1,y1)。每次移动一步,都必须在圆桌边缘固定一个点然后将圆桌绕这个点旋转。问最少需要移动几步。

// ConsoleApplication5.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include<vector>
#include<iostream>
#include<string>
#include <stack>
using namespace std;

int main()
{
	double r, x, y, x1, y1;
	while (cin >> r >> x >> y >> x1 >> y1)
	{
		double len = sqrt((x1 - x)*(x1 - x) + (y1 - y)*(y1 - y));
		int num = ceil(len / (2 * r));
		cout << num << endl;
	}
return 0;
}
原文地址:https://www.cnblogs.com/wdan2016/p/6515139.html