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

Ural 1033 Labyrinth

Accepted
0.015 217 KB

1033. Labyrinth

Time Limit: 1.0 second
Memory Limit: 16 MB
Administration of the labyrinth has decided to start a new season with new wallpapers. For this purpose they need a program to calculate the square of the walls inside the labyrinth. This job is just for you!
The labyrinth is represented by a matrix N×N (3 ≤ N ≤ 33, you see, ‘3’ is a magic digit!). Some matrix cells contain a dot character (‘.’) that denotes an empty square. Other cells contain a diesis character (‘#’) that denotes a square filled by monolith block of stone wall. All squares are of the same size 3×3 meters.
The walls are constructed around the labyrinth (except for the upper left and lower right corners, which are used as entrances) and on the cells with a diesis character. No other walls are constructed. There always will be a dot character at the upper left and lower right corner cells of the input matrix.
Problem illustration
Your task is to calculate the square of visible part of the walls inside the labyrinth. In other words, the square of the walls' surface visible to a visitor of the labyrinth. Note that there's no holes to look or to move through between any two adjacent blocks of the wall. The blocks are considered to be adjacent if they touch each other in any corner. See picture for an example: visible walls inside the labyrinth are drawn with bold lines. The height of all the walls is 3 meters.

Input

The first line of the input contains the single number N. The next N lines contain N characters each. Each line describes one row of the labyrinth matrix. In each line only dot and diesis characters will be used and each line will be finished with a new line character. There will be no spaces in the input.

Output

Your program should print to the output a single integer — the exact value of the square of the wallpaper needed.

Sample

input output
5
            .....
            ...##
            ..#..
            ..###
            .....
            
198
            

搜索題:注意的要從兩個入口處搜索,防止中間斷開了
wa了兩次 找不出錯誤,search(i+1,j)寫成search(i+1,j+1);
#include<iostream>
#include
<cstring>
using namespace std;

int const maxSize=35;

class ural1033
{
public:
    ural1033(){ size
=0; memset(f,0,sizeof f); }
    
void input();
    
void print();
    
void search(int i, int j);
    
int size;
    
int getn(){return N;}
private:
    
char a[maxSize][maxSize];
    
bool f[maxSize][maxSize];
    
int N;
};

void ural1033::input()
{
     cin
>>N;
     
int i,j;
     
for(i=1; i<=N; i++)
        
for(j=1; j<=N; j++)
            cin
>>a[i][j];
    
for(i=2; i<=N+1; i++)a[0][i]='#';
    
for(i=2; i<=N+1; i++)a[i][0]='#';
    
for(i=1; i<=N-1; i++)a[N+1][i]='#';
    
for(i=1; i<=N-1; i++)a[i][N+1]='#';

}

void ural1033:: search(int i, int j)
{
    
if(i<1||i>N||j<1||j>N||a[i][j]=='#'||f[i][j]==1)return ;
    f[i][j]
=1;
    
if(a[i-1][j]=='#')size++;
       
else search(i-1,j);
    
if(a[i][j-1]=='#')size++;
       
else search(i,j-1);
    
if(a[i][j+1]=='#')size++;
       
else search(i,j+1);
    
if(a[i+1][j]=='#')size++;
       
else search(i+1,j);
}

void ural1033::print()
{
     
for(int i=0; i<=N+1; i++,cout<<endl)
     
for(int j=0; j<=N+1; j++)
     cout
<<a[i][j]<<' ';
     cout
<<endl<<endl;
     
     
for(int i=0; i<=N+1; i++,cout<<endl)
     
for(int j=0; j<=N+1; j++)
     cout
<<f[i][j]<<' ';
}

int main()
{
    ural1033 ural;
    ural.input();
    
    ural.search(
1,1);
    ural.search(ural.getn(),ural.getn());
    
    cout
<<ural.size*9<<endl;
    
    system(
"pause");
    
return 0;
}

posted on 2010-06-24 23:02 田兵 閱讀(417) 評論(0)  編輯 收藏 引用 所屬分類: URAL

<2010年6月>
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

導航

統計

常用鏈接

留言簿(2)

隨筆分類(65)

隨筆檔案(65)

文章檔案(2)

ACM

搜索

積分與排名

最新隨筆

最新評論

閱讀排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            免费短视频成人日韩| 欧美va天堂va视频va在线| 亚洲理论在线观看| 欧美一级在线播放| 日韩视频亚洲视频| 乱中年女人伦av一区二区| 国产精品三级久久久久久电影| 亚洲精品在线观| 欧美激情一区二区在线| 久久久女女女女999久久| 国产日韩一区| 久久精品盗摄| 久久成人国产精品| 在线观看亚洲a| 欧美freesex8一10精品| 另类天堂视频在线观看| 91久久精品美女| 亚洲国产乱码最新视频| 欧美成黄导航| 一本不卡影院| 9久re热视频在线精品| 欧美午夜剧场| 欧美一站二站| 久久精品成人一区二区三区| 伊人狠狠色j香婷婷综合| 牛牛影视久久网| 欧美激情日韩| 亚洲在线视频观看| 午夜精品在线| 亚洲黄网站黄| 中文av一区二区| 国产在线精品二区| 欧美国产日韩免费| 欧美日本中文字幕| 午夜精品剧场| 久久精品男女| 日韩午夜免费视频| 亚洲一区二区免费看| 国内揄拍国内精品久久| 亚洲高清一二三区| 国产精品乱码一区二区三区| 久久久激情视频| 欧美激情精品久久久| 亚洲午夜一区| 久久精品国产69国产精品亚洲| 亚洲激情一区| 亚洲欧美日韩国产中文 | 亚洲六月丁香色婷婷综合久久| 亚洲日本va在线观看| 国产麻豆91精品| 欧美高清视频一区二区三区在线观看| 欧美精品久久久久久久久久| 欧美一区二区三区四区视频| 欧美va亚洲va香蕉在线| 欧美一级一区| 欧美日韩在线免费观看| 麻豆成人91精品二区三区| 欧美色视频在线| 欧美成人午夜激情在线| 国产精品亚发布| 91久久夜色精品国产九色| 国产亚洲欧美日韩美女| 亚洲精品字幕| 亚洲高清一区二| 欧美亚洲免费高清在线观看| 在线亚洲欧美专区二区| 老司机午夜免费精品视频| 久久高清免费观看| 国产精品二区影院| 最近中文字幕日韩精品 | 亚洲影视综合| 欧美激情区在线播放| 牛牛影视久久网| 国产一区二区精品久久91| 9色精品在线| 一区二区三区久久精品| 两个人的视频www国产精品| 久久久久九九九| 国产视频久久| 亚洲女性裸体视频| 亚洲欧美电影在线观看| 欧美日韩一卡| 亚洲精品资源美女情侣酒店| 亚洲精品久久久一区二区三区| 久久精品首页| 久久免费黄色| 激情成人在线视频| 久久国产精品久久久久久| 久久av一区二区三区| 国产欧美一区二区三区国产幕精品 | 美国十次了思思久久精品导航| 国产女主播视频一区二区| 国产精品99久久久久久久vr| 中日韩午夜理伦电影免费| 欧美精品1区| 亚洲精品在线观看免费| 一本久久青青| 国产精品成人一区二区网站软件| av成人福利| 性色av香蕉一区二区| 国产偷久久久精品专区| 久久精品欧美日韩| 欧美高清成人| 亚洲美女免费视频| 欧美系列电影免费观看| 亚洲综合三区| 六月丁香综合| 亚洲久久一区二区| 国产精品高清免费在线观看| 亚洲免费在线观看| 久久手机免费观看| 亚洲精品久久嫩草网站秘色 | 欧美日韩国产精品一卡| 一本久道久久综合狠狠爱| 午夜亚洲福利| 一区二区在线视频| 免费亚洲一区二区| 一区二区三区四区蜜桃| 久久久精品一区二区三区| 在线欧美亚洲| 欧美日韩综合不卡| 久久er99精品| 亚洲精品久久7777| 欧美亚洲免费在线| 亚洲第一视频| 国产精品mv在线观看| 久久久99免费视频| 亚洲精品护士| 久久综合色婷婷| 亚洲私人黄色宅男| 在线免费观看日本一区| 国产精品ⅴa在线观看h| 久久久精品日韩欧美| 日韩系列欧美系列| 久久综合一区二区三区| 亚洲一区三区视频在线观看| 激情五月婷婷综合| 国产精品国产三级国产专播精品人| 久久精品国产91精品亚洲| 亚洲精品中文在线| 麻豆精品传媒视频| 午夜日韩电影| 9l国产精品久久久久麻豆| 狠狠色狠狠色综合| 国产精品日本一区二区| 欧美高清在线视频| 久久精彩视频| 亚洲欧美日韩国产中文在线| 亚洲精品1区2区| 嫩草伊人久久精品少妇av杨幂| 性欧美xxxx大乳国产app| 99热这里只有成人精品国产| 激情成人亚洲| 国产偷国产偷亚洲高清97cao| 欧美三级午夜理伦三级中文幕| 美女国产一区| 久久久久99| 久久精品国产久精国产爱| 欧美高清自拍一区| 亚洲无线观看| 日韩视频免费看| 亚洲国产综合91精品麻豆| 麻豆av一区二区三区| 久久精品综合一区| 欧美一区2区视频在线观看| 亚洲视频图片小说| 99精品视频一区二区三区| 亚洲国产精品成人精品| 黄色国产精品一区二区三区| 国产亚洲在线| 国产亚洲成av人片在线观看桃| 国产精品美女久久| 国产精品视频xxx| 国产精品美女久久久久久久| 国产精品hd| 欧美视频一二三区| 国产精品久久婷婷六月丁香| 国产精品九色蝌蚪自拍| 国产精品免费小视频| 国产精品自在线| 国产偷久久久精品专区| 国产亚洲美州欧州综合国| 国产综合精品一区| 亚洲二区视频| 亚洲精品中文字幕有码专区| 最新成人av在线| 亚洲人久久久| 一区二区日韩| 亚洲午夜精品17c| 香蕉久久精品日日躁夜夜躁| 香蕉亚洲视频| 久久午夜羞羞影院免费观看| 欧美成人一区二区| 最新亚洲电影| 亚洲视频中文| 久久久久久国产精品一区| 女女同性精品视频| 亚洲国产欧美一区二区三区丁香婷| 亚洲国产成人tv| 亚洲亚洲精品三区日韩精品在线视频|