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

            結(jié)果就是各線段長度的和加上半徑為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

            導(dǎo)航

            統(tǒng)計

            常用鏈接

            留言簿(2)

            隨筆分類(65)

            隨筆檔案(65)

            文章檔案(2)

            ACM

            搜索

            積分與排名

            最新隨筆

            最新評論

            閱讀排行榜

            日韩美女18网站久久精品| 伊人久久久AV老熟妇色| 国产AV影片久久久久久| 久久久久一级精品亚洲国产成人综合AV区 | 97久久香蕉国产线看观看| 国产精品久久网| 久久国产成人亚洲精品影院| 99久久精品免费看国产一区二区三区 | 国产精品成人99久久久久91gav| 99久久精品九九亚洲精品| 精品综合久久久久久88小说| 亚洲AV伊人久久青青草原| 成人国内精品久久久久一区| 国产精品综合久久第一页| 亚洲AV日韩AV永久无码久久| 日韩人妻无码精品久久免费一| 国产精品久久久久久搜索| 狠狠色丁香久久婷婷综合_中| 狠狠色噜噜色狠狠狠综合久久| 久久99毛片免费观看不卡| 影音先锋女人AV鲁色资源网久久 | 亚洲欧美久久久久9999| 久久国产精品久久国产精品| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 99久久99久久精品免费看蜜桃 | 99久久综合国产精品二区| 欧美丰满熟妇BBB久久久| 热综合一本伊人久久精品| 一级做a爰片久久毛片人呢| 亚洲国产欧洲综合997久久| 一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区 | 91久久九九无码成人网站| 99久久99久久久精品齐齐| 久久久亚洲AV波多野结衣| 久久国产V一级毛多内射| 中文字幕乱码人妻无码久久| 欧美与黑人午夜性猛交久久久| 色欲av伊人久久大香线蕉影院| 精品国产综合区久久久久久| 国产亚洲精久久久久久无码77777| 亚洲天堂久久精品|