• <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>

            先求凸包,答案是凸包周長(zhǎng) + 2πl。因?yàn)楹?jiǎn)單多邊形的轉(zhuǎn)角是360度,所以加上一個(gè)圓的周長(zhǎng)。

             

            /*************************************************************************
            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 閱讀(495) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): 計(jì)算幾何
             
            久久久久国产精品人妻| 综合人妻久久一区二区精品| 囯产极品美女高潮无套久久久| 中文精品99久久国产 | 久久国产香蕉一区精品| 成人a毛片久久免费播放| 久久久精品视频免费观看| 久久婷婷五月综合成人D啪| 久久精品无码一区二区WWW| 久久精品国产亚洲麻豆| 一本大道久久东京热无码AV| 久久成人影院精品777| 色婷婷久久综合中文久久一本| 中文字幕精品久久久久人妻| 2021精品国产综合久久| 亚洲国产成人精品久久久国产成人一区二区三区综 | 亚洲Av无码国产情品久久| 亚洲国产另类久久久精品小说| 久久国产高清字幕中文| 午夜肉伦伦影院久久精品免费看国产一区二区三区| 热久久视久久精品18| 亚洲国产精品久久久久婷婷老年| 国产精品中文久久久久久久| 国产精品成人久久久久久久| 久久久久无码精品国产不卡| 亚洲精品国产自在久久| 国产成人精品久久综合 | 国产AV影片久久久久久| 久久久久AV综合网成人| 亚洲欧美另类日本久久国产真实乱对白 | 久久久久亚洲爆乳少妇无| 久久99精品久久久久久hb无码| 一本久久免费视频| 亚洲精品国产综合久久一线| 久久se精品一区二区影院| 国产高潮久久免费观看| 国产69精品久久久久99| 97久久精品人人澡人人爽| 99久久精品久久久久久清纯| 久久久久国产一级毛片高清版| 99久久99这里只有免费费精品|