• <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。因為簡單多邊形的轉(zhuǎn)角是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 閱讀(493) 評論(0)  編輯 收藏 引用 所屬分類: 計算幾何
             
            色噜噜狠狠先锋影音久久| 久久精品国产亚洲精品| 亚洲AV无一区二区三区久久 | 99久久国产免费福利| 99国内精品久久久久久久| 久久97久久97精品免视看秋霞| 国产精品99久久精品爆乳| 色播久久人人爽人人爽人人片AV| 久久久久久久女国产乱让韩| 久久婷婷成人综合色综合| 九九久久精品国产| 欧洲人妻丰满av无码久久不卡| 99久久久国产精品免费无卡顿| 久久国产综合精品五月天| 奇米影视7777久久精品| 久久午夜无码鲁丝片午夜精品| 亚洲va中文字幕无码久久不卡| 国产成人精品久久亚洲| 亚洲精品乱码久久久久久蜜桃图片 | 激情五月综合综合久久69| 亚洲国产精品成人久久| 亚洲精品99久久久久中文字幕 | 久久r热这里有精品视频| 午夜精品久久久久| 国产精品热久久无码av| 久久久无码一区二区三区| 亚洲欧美国产日韩综合久久| segui久久国产精品| jizzjizz国产精品久久| 久久精品国产99久久无毒不卡| 亚洲国产一成久久精品国产成人综合 | 亚洲国产精品婷婷久久| 丰满少妇人妻久久久久久| 色狠狠久久AV五月综合| 色婷婷综合久久久久中文一区二区| 久久久亚洲裙底偷窥综合| 伊人久久精品影院| 欧美色综合久久久久久| 国产人久久人人人人爽| 99久久精品国产高清一区二区 | 久久久久久国产a免费观看黄色大片 |