• <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 田兵 閱讀(368) 評論(0)  編輯 收藏 引用 所屬分類: URAL

            <2010年5月>
            2526272829301
            2345678
            9101112131415
            16171819202122
            23242526272829
            303112345

            導航

            統計

            常用鏈接

            留言簿(2)

            隨筆分類(65)

            隨筆檔案(65)

            文章檔案(2)

            ACM

            搜索

            積分與排名

            最新隨筆

            最新評論

            閱讀排行榜

            一本色道久久99一综合| 青青热久久国产久精品| 精品国产一区二区三区久久| 久久最新精品国产| 亚洲色欲久久久久综合网| 久久人人爽人人爽人人AV东京热| 国产精品欧美久久久天天影视| 久久天天躁狠狠躁夜夜不卡| 久久精品人人做人人爽电影蜜月| 国产精品gz久久久| 人人狠狠综合久久88成人| 久久亚洲国产精品五月天婷| 人妻少妇久久中文字幕一区二区| 亚洲国产成人精品久久久国产成人一区二区三区综 | 亚洲日韩欧美一区久久久久我| 久久久无码精品亚洲日韩蜜臀浪潮| 亚洲精品高清国产一久久| 亚洲色欲久久久综合网| 久久久不卡国产精品一区二区| 久久A级毛片免费观看| 色综合久久天天综线观看| 久久综合久久综合久久| 久久国产高潮流白浆免费观看| 精品熟女少妇AV免费久久| 要久久爱在线免费观看| 久久精品国产福利国产琪琪| 一级做a爰片久久毛片16| 99久久中文字幕| 国产精品天天影视久久综合网| 亚洲AV无码久久| 亚洲精品白浆高清久久久久久| 久久午夜无码鲁丝片秋霞| 久久亚洲精品国产亚洲老地址| 欧美激情精品久久久久久久九九九| 国产激情久久久久影院小草| 丁香五月综合久久激情| 国产免费久久久久久无码| 亚洲国产综合久久天堂 | 91麻豆精品国产91久久久久久| 久久国产精品久久国产精品| 国产成人香蕉久久久久 |