ural 1020. Rope(几何)
2014-10-24 00:08
302 查看
题目链接:ural 1020. Rope
题目大意:按照顺序给定N个点,每个点有半径R,问说用线环绕N个点所需要的长度。
解题思路:因为需要围成一个圈,所以旋转角度一定是一周,板径又都相同,所以直接就是两两点之间的距离加上一个周长。
题目大意:按照顺序给定N个点,每个点有半径R,问说用线环绕N个点所需要的长度。
解题思路:因为需要围成一个圈,所以旋转角度一定是一周,板径又都相同,所以直接就是两两点之间的距离加上一个周长。
#include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; const int maxn = 105; const double pi = 4 * atan(1.0); int N; double R, x[maxn], y[maxn]; double dis (double x, double y) { return sqrt(x * x + y * y); } int main () { while (scanf("%d%lf", &N, &R) == 2) { for (int i = 0; i < N; i++) scanf("%lf%lf", &x[i], &y[i]); x = x[0], y = y[0]; double ans = 2 * pi * R; for (int i = 0; i < N; i++) ans += dis(x[i]-x[i+1], y[i]-y[i+1]); printf("%.2lf\n", ans); } return 0; }
相关文章推荐
- URAL 1020 Rope 简单几何
- Ural-1020. Rope(简单计算几何)
- URAL 1020 Rope(圆与切线)
- URAL1020 ROPE
- Ural 1020 Rope 解题报告
- Ural 1020 Rope 解题报告
- ural 1020 Rope
- URAL 1020 Rope
- ural 1020 Rope
- 计算几何 ural 1207 Median on the Plane
- Ural_1207. Median on the Plane(计算几何)
- ural 1207 计算几何
- URAL 1145. Rope in the Labyrinth(两次BFS啊 )
- URAL - 1793 Tray 2(几何题)
- BZOJ_1020_[SHOI2008]_安全的航线flight_(计算几何+二分)
- Ural_1348. Goat in the Garden 2(计算几何)
- [bzoj1020][SHOI2008]安全的航线flight【迭代】【计算几何】
- URAL 1963 Kite 计算几何
- 计算几何 ural 1874
- URAL 1294. Mars Satellites 几何