zoukankan      html  css  js  c++  java
  • poj2365

    简单题

    View Code
    #include <iostream>
    #include
    <cstdio>
    #include
    <cstdlib>
    #include
    <cstring>
    #include
    <cmath>
    using namespace std;

    #define pi acos(-1)

    struct Point
    {
    double x, y;
    }first, now, last;

    int n;
    double r;

    double dist(Point &a, Point &b)
    {
    Point p;
    p.x
    = a.x - b.x;
    p.y
    = a.y - b.y;
    return sqrt(p.x * p.x + p.y * p.y);
    }

    int main()
    {
    //freopen("t.txt", "r", stdin);
    scanf("%d%lf", &n, &r);
    double ans = pi * 2 * r;
    scanf(
    "%lf%lf", &first.x, &first.y);
    last
    = first;
    for (int i = 1; i < n; i++)
    {
    scanf(
    "%lf%lf", &now.x, &now.y);
    ans
    += dist(now, last);
    last
    = now;
    }
    ans
    += dist(last, first);
    printf(
    "%.2f\n", ans);
    return 0;
    }
  • 相关阅读:
    图论初步
    分块和块状链表
    线段树入门
    ST表与树状数组
    [luogu P1312]Mayan游戏
    [luoguP4139]上帝与集合的正确用法


    电解质
    无机盐
  • 原文地址:https://www.cnblogs.com/rainydays/p/2124898.html
Copyright © 2011-2022 走看看