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

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 田兵 閱讀(419) 評論(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>
            你懂的国产精品永久在线| 欧美精品亚洲精品| 亚洲高清视频中文字幕| 欧美电影专区| 欧美日本在线看| 亚洲一区二区三区四区在线观看| 在线综合亚洲| 国产亚洲精品bv在线观看| 久久香蕉国产线看观看网| 免费成人高清在线视频| 一本久久综合| 亚洲欧美资源在线| 1769国产精品| 9i看片成人免费高清| 国产精品一区视频| 玖玖国产精品视频| 欧美精品激情在线观看| 亚洲主播在线| 久久久久这里只有精品| 日韩视频中午一区| 亚洲免费视频成人| 亚洲在线视频观看| 久久国产66| 亚洲伦理在线免费看| 亚洲性线免费观看视频成熟| 狠狠色伊人亚洲综合成人| 亚洲国产日韩精品| 欧美性做爰毛片| 久久久久久久久久码影片| 久久伊人一区二区| 国产精品99久久99久久久二8 | 亚洲一区二区三区三| 激情久久五月| av不卡免费看| 一区二区三区在线观看国产| 欧美激情在线| 国产精品福利在线观看| 久久综合一区| 欧美午夜视频在线观看| 老司机久久99久久精品播放免费| 欧美日韩久久精品| 久久综合中文字幕| 欧美系列亚洲系列| 欧美激情一区| 国产日韩欧美另类| 亚洲精品乱码久久久久久久久| 国产亚洲欧美日韩精品| 亚洲人成小说网站色在线| 国产婷婷色一区二区三区四区| 亚洲激情图片小说视频| 国产综合精品| 亚洲天堂成人| 亚洲精品三级| 久久精品伊人| 亚洲欧美综合国产精品一区| 欧美成人综合一区| 久久久久国色av免费看影院 | 欧美一级一区| 欧美另类综合| 欧美aaa级| 国产亚洲综合精品| 一区二区日韩伦理片| 亚洲人精品午夜| 久久国产加勒比精品无码| av不卡在线观看| 久久综合网络一区二区| 久久成人精品视频| 国产精品扒开腿做爽爽爽视频| 欧美大片免费观看在线观看网站推荐| 国产精品免费观看视频| 亚洲日本电影| 亚洲经典在线看| 欧美在线一二三区| 亚洲欧美亚洲| 欧美色精品天天在线观看视频| 欧美韩日一区二区三区| 精品91免费| 亚洲一区二区三区激情| 一本色道久久综合| 99精品国产一区二区青青牛奶| 久久综合中文色婷婷| 久久精品成人一区二区三区蜜臀| 国产精品福利av| 亚洲另类自拍| 99国产精品久久久久久久| 美日韩精品免费| 免费亚洲电影| 一区二区在线免费观看| 欧美在线免费观看亚洲| 性久久久久久久久久久久| 欧美性事免费在线观看| 一本久久a久久免费精品不卡| 亚洲三级免费观看| 你懂的国产精品| 欧美成人精品高清在线播放| 在线精品视频一区二区三四| 久久狠狠婷婷| 久久亚洲综合色| 黄页网站一区| 久久久国产精品一区二区中文| 久久久久久久999| 国产亚洲激情在线| 欧美伊人久久久久久午夜久久久久 | 亚洲激情婷婷| 激情久久久久久久| 久久在线免费| 欧美电影在线| 亚洲精品久久嫩草网站秘色 | 亚洲美女免费视频| 欧美激情影音先锋| 亚洲精品三级| 亚洲在线观看免费| 国产精品裸体一区二区三区| 亚洲一区不卡| 欧美影院精品一区| 国产视频一区欧美| 久久精品综合| 欧美高清在线视频| 亚洲美女网站| 国产精品theporn| 在线视频精品| 久久er精品视频| 激情一区二区| 嫩草影视亚洲| 日韩一区二区精品葵司在线| 亚洲在线黄色| 国产欧美日韩综合一区在线观看 | 亚洲少妇最新在线视频| 欧美亚洲综合在线| 韩国精品在线观看| 你懂的国产精品永久在线| 国产一区二区久久| 日韩视频在线观看| 午夜精品久久久久99热蜜桃导演| 国产噜噜噜噜噜久久久久久久久| 久久riav二区三区| 欧美~级网站不卡| 亚洲精品在线免费| 国产精品久久波多野结衣| 午夜日韩在线| 欧美激情第六页| 亚洲小说欧美另类社区| 国产精品亚洲人在线观看| 久久精品国产清自在天天线| 欧美顶级艳妇交换群宴| 夜夜嗨av一区二区三区四季av| 国产精品久久久亚洲一区 | 国产午夜精品理论片a级大结局| 久久精品国产一区二区三| 久久久久久尹人网香蕉| 亚洲日韩中文字幕在线播放| 欧美午夜国产| 久久久999精品免费| 亚洲精品久久久蜜桃| 欧美一区二区福利在线| 在线成人小视频| 欧美色另类天堂2015| 欧美一级免费视频| 亚洲国产欧美在线| 欧美一区综合| 亚洲美女精品成人在线视频| 国产精品高清免费在线观看| 欧美在线一区二区三区| 亚洲欧洲日本一区二区三区| 欧美一区精品| 日韩视频中午一区| 国产亚洲精品久| 欧美日韩精品免费观看视频| 午夜视频一区在线观看| 亚洲国产成人午夜在线一区| 欧美一区二区三区久久精品茉莉花| 在线观看亚洲视频| 国产精品劲爆视频| 欧美**字幕| 午夜精品久久久久久久男人的天堂| 欧美国产免费| 欧美在线视屏| 一本综合精品| 黄色日韩网站| 国产精品乱码一区二三区小蝌蚪| 免费成人网www| 欧美一二区视频| 日韩视频免费| 欧美国产亚洲视频| 久久激情视频久久| 亚洲一区二区伦理| 国产偷国产偷亚洲高清97cao| 欧美日本亚洲| 嫩草伊人久久精品少妇av杨幂| 亚洲欧美日韩成人| 99国内精品| 欧美成人午夜免费视在线看片| 欧美一区二区三区日韩视频| 一本久久a久久精品亚洲| 在线观看一区视频| 国产午夜精品久久久久久免费视| 欧美调教vk| 欧美国产高清| 噜噜噜久久亚洲精品国产品小说| 午夜精品福利一区二区蜜股av|