• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            先求凸包,答案是凸包周長 + 2πl。因為簡單多邊形的轉角是360度,所以加上一個圓的周長。

             

            /*************************************************************************
            Author: WHU_GCC
            Created Time: 2007-8-21 15:02:36
            File Name: pku1113.cpp
            Description: 
            ***********************************************************************
            */

            #include 
            <iostream>
            #include 
            <cmath>
            using namespace std;

            #define out(x) (cout << #x << ": " << x << endl)
            typedef 
            long long int64;
            const int maxint = 0x7FFFFFFF;
            const int64 maxint64 = 0x7FFFFFFFFFFFFFFFLL;
            template 
            <class T> void show(T a, int n) for (int i = 0; i < n; ++i) cout << a[i] << ' '; cout << endl; }
            template 
            <class T> void show(T a, int r, int l) for (int i = 0; i < r; ++i) show(a[i], l); cout << endl; }

            const int maxn = 1001;

            typedef 
            struct point_t
            {
                
            int x, y;
            }
            ;

            typedef 
            struct polygon_t
            {
                
            int n;
                point_t p[maxn];
            }
            ;

            int operator <(const point_t &a, const point_t &b)
            {
                
            return a.y < b.y || a.y == b.y && a.x < b.x;
            }


            point_t 
            operator -(const point_t &a, const point_t &b)
            {
                point_t ret;
                ret.x 
            = a.x - b.x;
                ret.y 
            = a.y - b.y;
                
            return ret;
            }


            double dist(const point_t &a, const point_t &b)
            {
                
            return sqrt(double((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)));
            }


            int cross(const point_t &a, const point_t &b)
            {
                
            return a.x * b.y - a.y * b.x;
            }


            int turn_left(const point_t &a, const point_t &b, const point_t &c)
            {
                
            return cross(b - a, c - b) > 0;
            }


            class point_set_c
            {
            public:
                
            void init(int _n, point_t _p[]);
                polygon_t convex_hull();
            private:
                
            int n;
                point_t p[maxn];
            }
            ;

            void point_set_c::init(int _n, point_t _p[maxn])
            {
                n 
            = _n;
                
            for (int i = 0; i < n; i++)
                    p[i] 
            = _p[i];
            }


            polygon_t point_set_c::convex_hull()
            {
                
            int stack[maxn];
                
            int top = 1;
                stack[
            0= 0;

                sort(p, p 
            + n);

                
            for (int i = 1; i < n;)
                
            {
                    
            if (top == 1 || turn_left(p[stack[top - 2]], p[stack[top - 1]], p[i]))
                        stack[top
            ++= i++;
                    
            else top--;
                }

                
            int t_top = top;
                
            for (int i = n - 2; i >= 0;)
                
            {
                    
            if (top == t_top || turn_left(p[stack[top - 2]], p[stack[top - 1]], p[i]))
                        stack[top
            ++= i--;
                    
            else top--;
                }

                
                polygon_t ret;
                ret.n 
            = 0;
                
            for (int i = 0; i < top - 1; i++)
                    ret.p[ret.n
            ++= p[stack[i]];
                
            return ret;
            }


            point_t p[maxn];
            int n;
            point_set_c ps;
            polygon_t poly;

            int main()
            {
                
            int l;
                
            while (scanf("%d%d"&n, &l) != EOF)
                
            {
                    
            for (int i = 0; i < n; i++)
                        scanf(
            "%d%d"&p[i].x, &p[i].y);
                    ps.init(n, p);
                    poly 
            = ps.convex_hull();

                    
            double ans = 0.0;
                    
            for (int i = 0; i < poly.n; i++)
                        ans 
            += dist(poly.p[i], poly.p[(i + 1% poly.n]);
                    ans 
            += 2 * l * acos(-1.0);
                    printf(
            "%.0lf\n", ans);
                }

                
            return 0;
            }
            posted on 2007-08-21 15:43 Felicia 閱讀(490) 評論(0)  編輯 收藏 引用 所屬分類: 計算幾何
             
            久久久无码精品亚洲日韩京东传媒 | av国内精品久久久久影院| 亚洲人成精品久久久久 | 久久综合丝袜日本网| 久久久WWW免费人成精品| 777午夜精品久久av蜜臀| 久久婷婷激情综合色综合俺也去| 99热精品久久只有精品| 一本色道久久88精品综合| 99久久精品免费| 久久精品国产亚洲精品2020| 久久精品国产精品亚洲人人 | 国内精品久久久久久久亚洲| 久久亚洲精品国产精品| 一本综合久久国产二区| 久久精品成人国产午夜| 少妇高潮惨叫久久久久久| 久久久久国产精品嫩草影院| 国产欧美一区二区久久| 久久WWW免费人成一看片| 日日狠狠久久偷偷色综合0| 中文精品久久久久国产网址 | 久久婷婷人人澡人人| 久久国产精品99国产精| 99久久夜色精品国产网站| 日本高清无卡码一区二区久久| 青青热久久综合网伊人| 97久久超碰国产精品旧版| 国产69精品久久久久观看软件| 日韩va亚洲va欧美va久久| 久久五月精品中文字幕| 久久青青草原精品国产软件| 久久精品国产亚洲7777| 国内精品久久久久久麻豆| 久久97久久97精品免视看| 久久成人精品| 日韩欧美亚洲综合久久影院Ds | 亚洲精品tv久久久久| 国产成人无码精品久久久免费| 天天综合久久久网| 天天久久狠狠色综合|