青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

coreBugZJ

此 blog 已棄。

EOJ 1189 Wall POJ 1113 Wall

  1/*
  2EOJ 1189 Wall
  3POJ 1113 Wall
  4
  5
  6----問題描述:
  7
  8Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he would not listen to his Architect's proposals to build a beautiful brick wall with a perfect shape and nice tall towers. Instead, he ordered to build the wall around the whole castle using the least amount of stone and labor, but demanded that the wall should not come closer to the castle than a certain distance. If the King finds that the Architect has used more resources to build the wall than it was absolutely necessary to satisfy those requirements, then the Architect will loose his head. Moreover, he demanded Architect to introduce at once a plan of the wall listing the exact amount of resources that are needed to build the wall.
  9
 10Your task is to help poor Architect to save his head, by writing a program that will find the minimum possible length of the wall that he could build around the castle to satisfy King's requirements.
 11
 12The task is somewhat simplified by the fact, that the King's castle has a polygonal shape and is situated on a flat ground. The Architect has already established a Cartesian coordinate system and has precisely measured the coordinates of all castle's vertices in feet. 
 13
 14
 15----輸入:
 16
 17Input contains several test cases. The first line of each case contains two integer numbers N and L separated by a space. N (3 <= N <= 1000) is the number of vertices in the King's castle, and L (1 <= L <= 1000) is the minimal number of feet that King allows for the wall to come close to the castle.
 18
 19Next N lines describe coordinates of castle's vertices in a clockwise order. Each line contains two integer numbers Xi and Yi separated by a space (-10000 <= Xi, Yi <= 10000) that represent the coordinates of ith vertex. All vertices are different and the sides of the castle do not intersect anywhere except for vertices.
 20 
 21Process to end of file. 
 22
 23
 24----輸出:
 25
 26For each case in the input, write to the output file the single number that represents the minimal possible length of the wall in feet that could be built around the castle to satisfy King's requirements. You must present the integer number of feet to the King, because the floating numbers are not invented yet. However, you must round the result in such a way, that it is accurate to 8 inches (1 foot is equal to 12 inches), since the King will not tolerate larger error in the estimates.
 27
 28
 29----樣例輸入:
 30
 319 100
 32200 400
 33300 400
 34300 300
 35400 300
 36400 400
 37500 400
 38500 200
 39350 200
 40200 200 
 41
 42
 43----樣例輸出:
 44
 451628
 46
 47
 48----分析:
 49
 50Graham-Scan 求凸包,再根據(jù)夾角,求弧長(zhǎng),而總弧長(zhǎng)就是周長(zhǎng)。
 51
 52
 53*/

 54
 55
 56#include <iostream>
 57#include <cstdio>
 58#include <cmath>
 59#include <algorithm>
 60
 61using namespace std;
 62
 63// #define  TEST
 64
 65#define  N  1009
 66typedef  pair< intint > Point;
 67#define  y  first
 68#define  x  second
 69#define  PI  3.14159265358979
 70
 71int    n;
 72int    le;
 73Point  p[ N ];
 74
 75double solve() {
 76        static Point stk[ N ];
 77        int    tp, i, ntp;
 78        double ans = 0;
 79
 80        sort( p, p+n );
 81
 82#ifdef  TEST
 83        for ( i = 0; i < n; ++i ) {
 84                printf( "x = %d  y = %d\n", p[ i ].x, p[ i ].y );
 85        }

 86#endif
 87
 88        tp = 0;
 89        stk[ tp ] = p[ 0 ];
 90        for ( i = 1; i < n; ++i ) {
 91                while ( (0 < tp) && 
 92                        ((stk[tp].x-stk[tp-1].x)*(p[i].y-stk[tp].y) - 
 93                         (p[i].x-stk[tp].x)*(stk[tp].y-stk[tp-1].y) <= 0
 94                      ) {
 95                                --tp;
 96                }

 97                ++tp;
 98                stk[ tp ] = p[ i ];
 99        }

100
101#ifdef  TEST
102        printf( "stk 1\n" );
103        for ( i = 0; i <= tp; ++i ) {
104                printf( "stk x = %d  y = %d\n", stk[ i ].x, stk[ i ].y );
105        }

106#endif
107
108        ntp = tp; // 左右鏈必須分開處理,點(diǎn)(n-1)左右鏈共用
109        for ( i = n-2; i >= 0--i ) {
110                while ( (ntp < tp) && 
111                        ((stk[tp].x-stk[tp-1].x)*(p[i].y-stk[tp].y) - 
112                         (p[i].x-stk[tp].x)*(stk[tp].y-stk[tp-1].y) <= 0
113                      ) {
114                                --tp;
115                }

116                ++tp;
117                stk[ tp ] = p[ i ];
118        }

119
120#ifdef  TEST
121        printf( "stk all\n" );
122        for ( i = 0; i <= tp; ++i ) {
123                printf( "stk x = %d  y = %d\n", stk[ i ].x, stk[ i ].y );
124        }

125#endif
126
127        for ( i = 0; i < tp; ++i ) {
128                ans += sqrt((double)( 
129                                (stk[i].x-stk[i+1].x)*(stk[i].x-stk[i+1].x) 
130                                + (stk[i].y-stk[i+1].y)*(stk[i].y-stk[i+1].y) 
131                        ));
132        }

133
134        ans += 2 * PI * le;
135        return ans;
136}

137
138int main() {
139        int i;
140        while ( 2 == scanf( "%d%d"&n, &le ) ) {
141                for ( i = 0; i < n; ++i ) {
142                        scanf( "%d%d"&(p[ i ].x), &(p[ i ].y) );
143                }

144                printf( "%0.0lf\n", solve() );
145        }

146        return 0;
147}

148

posted on 2012-05-13 22:52 coreBugZJ 閱讀(756) 評(píng)論(0)  編輯 收藏 引用 所屬分類: ACMAlgorithm課內(nèi)作業(yè)

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            亚洲美女淫视频| 在线视频亚洲一区| 麻豆av一区二区三区| 午夜伦理片一区| 国产亚洲观看| 免费亚洲电影| 欧美激情一区二区三级高清视频| 亚洲精品一区在线观看| 亚洲精品久久久久久久久久久| 欧美国产高潮xxxx1819| 99精品99| 午夜精品久久久久久久男人的天堂 | 久久一区二区精品| 久久精品一本久久99精品| 在线免费观看一区二区三区| 亚洲国产影院| 国产精品一区二区三区乱码| 巨乳诱惑日韩免费av| 欧美另类videos死尸| 亚洲免费一区二区| 久久夜色撩人精品| 亚洲午夜国产成人av电影男同| 香蕉久久夜色精品国产使用方法 | 欧美日韩国产综合新一区| 亚洲免费在线电影| 久久精品免费电影| 一本久久综合亚洲鲁鲁五月天| 午夜久久久久久久久久一区二区| 亚洲国产精品高清久久久| 99精品视频免费观看视频| 激情综合色综合久久综合| 亚洲激情欧美激情| 国产一区二区久久| 99视频一区二区三区| 欲色影视综合吧| 亚洲视频欧美在线| 亚洲国产一区在线观看| 亚洲在线网站| 一本综合久久| 久久久福利视频| 欧美一区二区三区在线播放| 欧美第一黄网免费网站| 久久久人成影片一区二区三区| 欧美无乱码久久久免费午夜一区| 欧美国产综合一区二区| 国产视频亚洲精品| 亚洲视频视频在线| 伊人成综合网伊人222| 一本色道久久综合狠狠躁的推荐| 午夜精品久久久久久久久久久久久| 亚洲国产va精品久久久不卡综合| 亚洲欧美韩国| 亚洲欧美国产高清va在线播| 欧美电影免费网站| 欧美xx69| 亚洲国产另类久久精品| 欧美尤物巨大精品爽| 欧美一级日韩一级| 国产精品欧美日韩一区二区| 日韩一级视频免费观看在线| 日韩手机在线导航| 欧美成人免费va影院高清| 欧美电影免费观看大全| 尤物在线精品| 蜜桃久久av一区| 欧美va天堂va视频va在线| 一区二区自拍| 美女亚洲精品| 亚洲国产精品嫩草影院| 亚洲国产另类 国产精品国产免费| 久久国产精品免费一区| 久久久久欧美| 亚洲国产经典视频| 狂野欧美激情性xxxx| 亚洲成人资源网| 亚洲美女黄色片| 欧美精品亚洲一区二区在线播放| 亚洲精品一区二区三区蜜桃久| 亚洲最新中文字幕| 国产精品久久久久一区二区三区共| 亚洲天堂网在线观看| 亚洲欧美激情视频在线观看一区二区三区 | 亚洲无吗在线| 国产区在线观看成人精品| 欧美一区二区三区日韩| 另类酷文…触手系列精品集v1小说| 亚洲国产精品一区二区www| 免费永久网站黄欧美| 亚洲精品久久久一区二区三区| 亚洲一区二区三区免费视频| 国产美女一区| 男人天堂欧美日韩| 日韩视频在线免费| 欧美一区二区免费观在线| 狠狠色丁香婷婷综合影院| 欧美r片在线| 亚洲欧美精品中文字幕在线| 麻豆久久婷婷| 亚洲一本大道在线| 激情自拍一区| 国产精品大片| 久热精品视频| 中日韩美女免费视频网址在线观看 | 久久久欧美精品sm网站| 亚洲人成7777| 国产日韩欧美亚洲一区| 欧美激情第二页| 欧美在线观看日本一区| 亚洲精品人人| 另类人畜视频在线| 亚洲欧美另类综合偷拍| 亚洲国产精品成人综合色在线婷婷 | 亚洲色图综合久久| 欧美电影免费观看大全| 欧美有码在线观看视频| 亚洲免费久久| 亚洲国产高清一区| 国产一区二区三区久久| 国产精品国产三级国产专区53 | 国产亚洲电影| 欧美性大战久久久久久久| 欧美成va人片在线观看| 久久激情网站| 午夜欧美不卡精品aaaaa| 亚洲免费精品| 亚洲精品一区二区三区婷婷月| 鲁大师影院一区二区三区| 午夜伦欧美伦电影理论片| aa级大片欧美三级| 亚洲人成亚洲人成在线观看图片| 狠狠色狠狠色综合| 国产欧美一区二区精品性色 | 欧美亚洲一区二区在线| 一区二区三区视频在线观看| 亚洲三级影院| 亚洲国产日韩综合一区| 欧美国产日韩xxxxx| 久久影院亚洲| 麻豆成人av| 免费观看成人www动漫视频| 久久蜜桃av一区精品变态类天堂| 欧美在线播放| 久久国产视频网站| 久久久精品国产免大香伊| 久久精品国产77777蜜臀| 欧美一区二区在线看| 欧美一区二区三区免费视频| 性欧美大战久久久久久久久| 香蕉成人伊视频在线观看| 羞羞答答国产精品www一本| 午夜在线一区二区| 久久精品国产亚洲一区二区三区| 久久久精品五月天| 免费日韩av片| 亚洲国产精品一区二区第一页 | 亚洲毛片网站| 中文成人激情娱乐网| 亚洲一二区在线| 欧美在线观看一区二区| 久久蜜臀精品av| 欧美精品久久一区| 国产精品捆绑调教| 国产一区二区三区在线观看精品| 狠狠久久亚洲欧美专区| 亚洲国产免费| 亚洲一区日韩| 久久尤物视频| 亚洲精品极品| 性色av一区二区三区在线观看 | 免费成人黄色片| 欧美少妇一区| 国内精品美女在线观看| 亚洲激情视频在线观看| 亚洲一区二区高清视频| 久久久久久久成人| 亚洲激情在线观看| 亚洲一区三区视频在线观看| 久久久久久久综合狠狠综合| 欧美日韩大片| 国产在线日韩| 中文欧美字幕免费| 噜噜爱69成人精品| 一道本一区二区| 久久一区视频| 国产人成精品一区二区三| 亚洲国产精品一区二区第四页av| 亚洲自拍偷拍网址| 免费观看在线综合| 亚洲一区二区av电影| 欧美11—12娇小xxxx| 国产日韩综合| 亚洲综合欧美| 亚洲人成网站999久久久综合| 欧美一区在线视频| 欧美色另类天堂2015| 亚洲国产精品嫩草影院| 久久久久久综合网天天| 中文欧美字幕免费| 欧美成人精品影院| 在线观看欧美日韩|