• <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)  編輯 收藏 引用 所屬分類: 計算幾何
             
            久久久艹| 日本亚洲色大成网站WWW久久| 无码人妻久久一区二区三区蜜桃| 久久久久亚洲精品天堂久久久久久 | 久久国产综合精品五月天| 久久久久无码中| 久久亚洲精品无码AV红樱桃| 99久久精品无码一区二区毛片| 香蕉99久久国产综合精品宅男自| 国产A级毛片久久久精品毛片| 蜜桃麻豆www久久| 亚洲中文久久精品无码| 国产精品成人无码久久久久久 | 精品国产99久久久久久麻豆| 久久精品国产只有精品2020| 老男人久久青草av高清| 激情久久久久久久久久| 久久精品aⅴ无码中文字字幕重口| 久久狠狠一本精品综合网| 国产精品免费看久久久| 久久只这里是精品66| 久久精品成人一区二区三区| 99精品久久精品一区二区| 亚洲中文久久精品无码ww16| 亚洲精品乱码久久久久久不卡| 国产精品激情综合久久| 91精品国产综合久久精品| 亚洲国产精品高清久久久| 色老头网站久久网| 伊人色综合久久天天网| 久久国产影院| 人妻无码久久精品| 青青青青久久精品国产h久久精品五福影院1421| www久久久天天com| A狠狠久久蜜臀婷色中文网| 久久精品国产免费| 中文字幕一区二区三区久久网站| 亚洲国产精品久久久久久| 大美女久久久久久j久久| 久久国产精品无码网站| 久久午夜综合久久|