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

            Ural 1020 Rope

            1020. Rope

            Time Limit: 1.0 second
            Memory Limit: 16 MB
            Plotters have barbarously hammered N nails into an innocent plane shape, so that one can see now only heads. Moreover, pursuing their mean object, they have hammered all the nails into the vertices of a convex polygon. After that they…it is awful… have roped off the nails, so that the shape felt upset (the rope was very thin). They’ve done it as it is shown in the figure.
            Problem illustration
            Your task is to find out a length of the rope.

            Input

            There two numbers in the first line of the standard input: N — a number of nails (1 ≤ N ≤ 100), and a real number R — a radius of heads of nails. All the heads have the same radius. Further there are N lines, each of them contains a pair of real coordinates (separated by a space) of centers of nails. An absolute value of the coordinates doesn’t exceed 100. The nails are described either in a clockwise or in a counterclockwise order starting from an arbitrary nail. Heads of different nails don’t adjoin.

            Output

            Output a real number with two digits precision (after a decimal point) — a length of the rope.

            Sample

            input output
            4 1
                                    0.0 0.0
                                    2.0 0.0
                                    2.0 2.0
                                    0.0 2.0
                                    
            14.28
                                    
            Problem Author: Alexander Petrov & Nikita Shamgunov
            Problem Source: Ural State University Internal Contest October'2000 Junior Session

            結果就是各線段長度的和加上半徑為R的周長,n=1時 需額外考慮下
            #include<iostream>
            #include
            <stdio.h>
            #include
            <cmath>
            using namespace std;
            double const  pi=acos(-1.0);
            int main()
            {
                
            int n=0,i=0;
                
            double sum=0,r=0,x0,y0,x1,y1,x,y;
                
                cin
            >>n>>r;
                cin
            >>x>>y;// 保存第一個點  
                
                x0
            =x1=x; y0=y1=y;
                sum
            =2*pi*r;
                
            for(i=1; i<n; i++)
                {
                         cin
            >>x1>>y1;
                         sum
            +=sqrt( (x1-x0)*(x1-x0)+ (y1-y0)*(y1-y0) );
                         x0
            =x1; y0=y1;
                }
                
            if(n!=1) sum+=sqrt( (x1-x)*(x1-x)+ (y1-y)*(y1-y) );
                
                printf(
            "%.2lf\n",sum);
                system(
            "pause");
                
            return 0;
            }

            posted on 2010-06-22 17:05 田兵 閱讀(351) 評論(0)  編輯 收藏 引用 所屬分類: URAL

            <2010年6月>
            303112345
            6789101112
            13141516171819
            20212223242526
            27282930123
            45678910

            導航

            統計

            常用鏈接

            留言簿(2)

            隨筆分類(65)

            隨筆檔案(65)

            文章檔案(2)

            ACM

            搜索

            積分與排名

            最新隨筆

            最新評論

            閱讀排行榜

            A级毛片无码久久精品免费| 欧美日韩久久中文字幕| 久久综合综合久久狠狠狠97色88| 九九久久自然熟的香蕉图片| 99久久无码一区人妻a黑| 香蕉久久一区二区不卡无毒影院| 国产免费福利体检区久久| 婷婷久久五月天| 久久久久久久综合日本亚洲| 色综合合久久天天给综看| 97精品伊人久久大香线蕉app| 久久精品无码一区二区app| 婷婷综合久久中文字幕蜜桃三电影| 久久国产乱子精品免费女| 久久午夜无码鲁丝片秋霞| 99久久综合国产精品二区| 日产精品久久久一区二区| 亚洲国产综合久久天堂 | 久久久久久久国产免费看| 日韩久久久久久中文人妻| 久久se精品一区精品二区国产| 九九99精品久久久久久| 亚洲国产精品成人久久蜜臀 | 好属妞这里只有精品久久| 99精品国产免费久久久久久下载| 久久久久久久99精品免费观看| 日韩av无码久久精品免费| 狠狠色综合网站久久久久久久高清 | 97r久久精品国产99国产精| 久久人妻无码中文字幕| 久久久久久无码国产精品中文字幕 | 国内精品综合久久久40p| 日批日出水久久亚洲精品tv| 99久久精品免费观看国产| 久久超碰97人人做人人爱| 婷婷久久久亚洲欧洲日产国码AV| 久久精品中文字幕一区| 18岁日韩内射颜射午夜久久成人| 久久人人青草97香蕉| 国产精品乱码久久久久久软件| 成人综合久久精品色婷婷|