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

            comiz

            2007年11月4日

            a problem of maze

            Problem Statement

            People enjoy mazes, but they also get them dirty. Arrows, graffiti, and chewing gum are just a few of the souvenirs people leave on the walls. You, the maze keeper, are assigned to whiten the maze walls. Each face of the wall requires one liter of paint, but you are only required to paint visible faces. You are given a map of the maze, and you must determine the amount of paint needed for the job.

            The maze is described by a vector <string> maze, where each character can be either '#' (a wall) or '.' (an empty space). All '.' characters on the perimeter of the map are considered entrances to the maze. Upon entering the maze, one can only move horizontally and vertically through empty spaces, and areas that are not reachable by these movements are not considered visible. Each '#' represents a square block with four wall faces (each side of the square is a face). A face is visible if it is not directly adjacent to another wall (and is in a reachable area of the maze). For example, two adjacent blocks can have at most six visible faces since two of their faces are directly adjacent to each other. All exterior faces on the perimeter are considered visible.

            For example, the following picture represents a trivial maze with just one (wide) entrance and only four empty reachable spaces:

             TroytownKeeper.png

            To whiten this maze you must paint the faces highlighted in yellow above: 16 for its perimeter, plus 8 interior faces. Note that there are faces that are not visible and thus need not be painted.

            Definition     

            Class: TroytownKeeper

            Method: limeLiters Parameters: vector <string>

            Returns: int

            Method signature: int limeLiters(vector <string> maze)

            (be sure your method is public)     

            Constraints

            - maze will contain between 1 and 50 elements, inclusive.

            - Each element of maze will contain between 1 and 50 characters, inclusive.

            - All elements of maze will have the same number of characters.

            - All characters in maze will be either '.' or '#' . Examples 0)  

             

               

            {"##..#",
            "#.#.#",
            "#.#.#",
            "#####"}
            Returns: 24

            posted @ 2007-11-04 19:35 comiz 閱讀(411) | 評論 (1)編輯 收藏

            2007年10月24日

            一道基礎(chǔ)題

            12,…,99個數(shù)分成三組,分別組成三個三位數(shù),且使這三個三位數(shù)構(gòu)成

               123的比例,試求出所有滿足條件的三個三位數(shù)。

               例如:三個三位數(shù)192,384,576滿足以上條件。
            題目比較基礎(chǔ),自己用的回朔法,萬里高樓平地起,慢慢來吧...
            /* Note:Your choice is C IDE */
            #define null 0
            #include "stdio.h"
            void inject(int N,int *nNum)
            {
                int sum[3],i,j,k;
                if(N==0)
                {
                    sum[0]=*nNum*100+*(nNum+1)*10+*(nNum+2);
                    sum[1]=*(nNum+3)*100+*(nNum+4)*10+*(nNum+5);
                    sum[2]=*(nNum+6)*100+*(nNum+7)*10+*(nNum+8);
                    if(((sum[0]<<1)==sum[1])&&((3*sum[0])==sum[2]))
                    {
                        printf("we have one of them:");   
                        printf("%d,%d,%d\n",sum[0],sum[1],sum[2]);
                    }
                }
                else
                {
                    for(j=0;j<9;j++)
                    {
                        if(*(nNum+j)==null)
                        {
                            *(nNum+j)=N;
                            inject(N-1,nNum);
                            *(nNum+j)=null;
                        }
                    }
                }
            }
            main()
            {
                int k;
                int Num[9];
                for(k=0;k<9;k++)
                {
                    Num[k]=null;   
                }
                    inject(9,Num);
            }

            posted @ 2007-10-24 18:22 comiz 閱讀(215) | 評論 (0)編輯 收藏

            僅列出標題  
            <2025年7月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            導航

            統(tǒng)計

            常用鏈接

            留言簿(1)

            隨筆檔案

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久99久国产麻精品66| 国产综合久久久久| 一个色综合久久| 99精品国产综合久久久久五月天| 亚洲香蕉网久久综合影视 | 亚洲国产精品嫩草影院久久| 精品久久亚洲中文无码| 91精品日韩人妻无码久久不卡| 看全色黄大色大片免费久久久| 久久香蕉国产线看观看精品yw| 国产精品综合久久第一页| 亚洲午夜久久久久久噜噜噜| 久久久久久久久久久免费精品 | 亚洲精品国精品久久99热一| avtt天堂网久久精品| 久久狠狠爱亚洲综合影院| 狠狠精品久久久无码中文字幕| 久久久久亚洲AV无码专区桃色| 亚洲va中文字幕无码久久不卡| 久久久久综合中文字幕| 热99re久久国超精品首页| 久久国产亚洲精品无码| 欧美性猛交xxxx免费看久久久| 97久久精品人人澡人人爽| 大伊人青草狠狠久久| 久久综合狠狠综合久久| 久久久久波多野结衣高潮| 亚洲精品无码久久毛片| 久久中文精品无码中文字幕| 国产三级观看久久| 国产无套内射久久久国产| 国内精品伊人久久久久| 久久综合久久综合九色| 久久亚洲精品中文字幕三区| 久久九九青青国产精品| 国产成人综合久久久久久| 久久精品国产清自在天天线| 国产成人香蕉久久久久| 欧美无乱码久久久免费午夜一区二区三区中文字幕 | 一本久道久久综合狠狠爱| 色妞色综合久久夜夜|