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

            Problem F : Glenbow Museum

            The famous Glenbow Museum in Calgary is Western Canada’s largest museum, with exhibits ranging from art to
            cultural history to mineralogy. A brand new section is being planned, devoted to brilliant computer programmers just
            like you. Unfortunately, due to lack of space, the museum is going to have to build a brand new building and relocate
            into it.

            The size and capacity of the new building differ from those of the original building. But the floor plans of both
            buildings are orthogonal polygons. An orthogonal polygon is a polygon whose internal angles are either 90° or 270°.
            If 90° angles are denoted as R (Right) and 270° angles are denoted as O (Obtuse) then a string containing only R and
            O can roughly describe an orthogonal polygon. For example, a rectangle (Figure 1) is the simplest orthogonal
            polygon and it can be described as RRRR (the angles are listed in counter-clockwise order, starting from any corner).
            Similarly, a cross-shaped orthogonal polygon (Figure 2) can be described by the sequence RRORRORRORRO,
            RORRORRORROR, or ORRORRORRORR. These sequences are called angle strings.

                    Figure 1: A rectangle              Figure 2: A cross-shaped polygon
            Of course, an angle string does not completely specify the shape of a polygon – it says nothing about the length of
            the sides. And some angle strings cannot possibly describe a valid orthogonal polygon (RRROR, for example).

            To complicate things further, not all orthogonal polygons are acceptable floor plans for the museum. A museum
            contains many valuable objects, and these objects must be guarded. Due to cost considerations, no floor can have
            more than one guard. So a floor plan is acceptable only if there is a place within the floor from which one guard can
            see the entire floor. Similarly, an angle string is acceptable only if it describes at least one acceptable polygon. Note
            that the cross-shaped polygon in Figure 2 can be guarded by someone standing in the center, so it is acceptable. Thus
            the angle string RRORRORRORRO is acceptable, even though it also describes other polygons that cannot be
            properly guarded by a single guard.

            Help the designers of the new building determine how many acceptable angle strings there are of a given length.

            Input
            The input file contains several test cases. Each test case consists of a line containing a positive integer L (1≤L≤1000),
            which is the desired length of an angle string.

            The input will end with a line containing a single zero.

            Output
            For each test case, print a line containing the test case number (beginning with 1) followed by the number of
            acceptable angle strings of the given length. Follow the format of the sample output.

            Sample Input
            4
            6
            0

            Output for the Sample Input
            Case 1: 1
            Case 2: 6

                從一個(gè)所有邊都平行于坐標(biāo)系的多邊形的任一頂點(diǎn)出發(fā),逆時(shí)針遍歷,記錄每次經(jīng)過(guò)的頂點(diǎn)處的轉(zhuǎn)角,組成的字符串叫做angle string。求指定長(zhǎng)度的angle string中,能表示至少一個(gè)星形多邊形的串個(gè)數(shù)。 
                顯然當(dāng)l=2k+1時(shí),解不存在;當(dāng)l=2k時(shí),設(shè)m=(l+4)/2,根據(jù)組合數(shù)的知識(shí),所求結(jié)果為C(m,4)+C(m-1,4)。
            400016  2009-04-24 04:51:44  Accepted  0.000  Minimum  19193  C++  4123 - Glenbow Museum
             1 #include <iostream>
             2 using namespace std;
             3 
             4 typedef long long LL;
             5 inline LL cal(LL n){             //C(n,4) 
             6     return n*(n-1)*(n-2)*(n-3)/24;
             7 }
             8 int main(){
             9     int ca=1;
            10     LL n;
            11     while(cin>>n,n){
            12         if(n & 1)
            13             cout<<"Case "<<ca++<<""<<0<<endl;
            14         else{
            15             n=(n+4)>>1;
            16             cout<<"Case "<<ca++<<""<<cal(n)+cal(n-1)<<endl;
            17         }
            18     }
            19     return 0;
            20 }

            posted on 2009-04-24 11:32 極限定律 閱讀(1026) 評(píng)論(0)  編輯 收藏 引用 所屬分類: ACM-ICPC World Final 2008題解

            <2009年7月>
            2829301234
            567891011
            12131415161718
            19202122232425
            2627282930311
            2345678

            導(dǎo)航

            統(tǒng)計(jì)

            常用鏈接

            留言簿(10)

            隨筆分類

            隨筆檔案

            友情鏈接

            搜索

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            久久久久久久久无码精品亚洲日韩 | 久久96国产精品久久久| 久久不射电影网| 合区精品久久久中文字幕一区| 亚洲中文字幕久久精品无码APP| www.久久99| 综合久久久久久中文字幕亚洲国产国产综合一区首 | 精品人妻久久久久久888| 精品无码人妻久久久久久| 久久妇女高潮几次MBA| 国产午夜精品久久久久九九电影| 国产精品99久久久精品无码| 成人资源影音先锋久久资源网| 欧美激情精品久久久久久| 狠狠色丁香久久综合五月| 亚洲va中文字幕无码久久不卡| 国产精品狼人久久久久影院| 97久久精品无码一区二区| 99精品国产99久久久久久97| 久久婷婷五月综合色99啪ak| 久久精品无码一区二区三区| 国内高清久久久久久| 精品久久久无码21p发布| 久久免费视频一区| 久久精品国产只有精品66| 丁香狠狠色婷婷久久综合| 久久国产精品99精品国产| 亚洲午夜久久久久久久久电影网 | 中文字幕成人精品久久不卡| 久久精品国产亚洲AV电影 | 99久久无色码中文字幕人妻| 久久香综合精品久久伊人| 亚洲人成无码久久电影网站| 香港aa三级久久三级老师2021国产三级精品三级在 | 天天久久狠狠色综合| 国产成人久久激情91| 天天久久狠狠色综合| 精品久久久久久无码中文野结衣| 国产精品欧美久久久久无广告| 国产精品丝袜久久久久久不卡| 国产高清美女一级a毛片久久w|