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

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 田兵 閱讀(410) 評論(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>
            日韩一二在线观看| 亚洲福利视频一区| 亚洲视频电影在线| 一区二区三区精密机械公司 | 亚洲高清不卡在线观看| 久久久蜜桃一区二区人| 亚洲国产精品电影在线观看| 亚洲高清自拍| 国产精品初高中精品久久| 午夜久久久久| 久久亚洲春色中文字幕久久久| 亚洲高清不卡在线| 99精品视频免费| 国产日韩在线看| 亚洲高清电影| 国产精品久久久久9999| 久久久精品性| 欧美日韩国产首页| 久久久久久久综合日本| 欧美国产一区二区| 性欧美大战久久久久久久免费观看 | 久久国产精品一区二区| 久久夜色精品国产欧美乱极品| 99人久久精品视频最新地址| 亚洲一区二区视频在线| 揄拍成人国产精品视频| 一区二区免费看| 亚洲第一黄色网| 亚洲香蕉在线观看| 亚洲人成久久| 亚洲综合电影一区二区三区| 亚洲韩国青草视频| 久久超碰97人人做人人爱| 国产精品99久久久久久久vr| 欧美制服第一页| 亚洲在线1234| 欧美国产综合视频| 久久亚洲一区二区三区四区| 国产精品都在这里| 亚洲激情综合| 亚洲国产高潮在线观看| 亚洲自拍偷拍视频| 一区二区三区**美女毛片| 久久精品亚洲一区二区| 欧美亚洲视频在线观看| 欧美日韩在线电影| 亚洲日本中文| 亚洲精品欧美| 欧美xart系列在线观看| 蜜桃伊人久久| 激情国产一区| 久久狠狠一本精品综合网| 欧美一区二区观看视频| 欧美性做爰毛片| 在线视频一区观看| 亚洲视频中文| 欧美午夜精品一区| 在线性视频日韩欧美| 中国日韩欧美久久久久久久久| 欧美国产91| 亚洲人成在线播放| 亚洲片在线观看| 欧美黄色aa电影| 亚洲精品国产欧美| 一个色综合av| 欧美日韩一级黄| 一区二区冒白浆视频| 亚洲欧美一区二区三区极速播放 | 欧美国产日韩在线观看| 亚洲国产91精品在线观看| 亚洲人成7777| 欧美日本不卡| 亚洲午夜黄色| 久久尤物视频| 最新精品在线| 欧美三区视频| 亚洲欧洲av一区二区三区久久| 久久精品国产欧美激情| 精品不卡一区| 欧美精品在线一区二区| 在线视频亚洲| 久久久美女艺术照精彩视频福利播放 | 中日韩视频在线观看| 午夜在线播放视频欧美| 好吊视频一区二区三区四区| 玖玖玖国产精品| 亚洲人成网站777色婷婷| 亚洲欧美国产高清| 国产自产v一区二区三区c| 麻豆亚洲精品| 洋洋av久久久久久久一区| 欧美一区二区免费视频| 亚洲成色777777在线观看影院| 欧美大片国产精品| 亚洲免费一区二区| 欧美成人免费观看| 亚洲视频视频在线| 国产一区二区三区黄视频| 久久综合影视| 亚洲综合国产| 亚洲电影自拍| 欧美综合激情网| 日韩亚洲一区二区| 好吊色欧美一区二区三区四区| 欧美激情黄色片| 欧美中文字幕在线播放| 亚洲精品小视频| 美女视频黄 久久| 午夜免费在线观看精品视频| 亚洲激情专区| 国产综合色精品一区二区三区| 欧美日韩成人在线播放| 久久久免费观看视频| 亚洲五月婷婷| 日韩一本二本av| 亚洲成人在线免费| 日韩午夜精品| 亚洲第一伊人| 国产三级精品在线不卡| 欧美偷拍另类| 欧美黄色视屏| 久久综合九色综合久99| 欧美在线啊v| 亚洲欧美日韩一区二区在线| 99热精品在线观看| 亚洲国产精品va在线看黑人动漫 | 亚洲作爱视频| 亚洲精品久久久久久久久久久| 黑丝一区二区三区| 国产精品一区二区在线观看不卡| 欧美精品国产精品日韩精品| 久久影院亚洲| 玖玖玖国产精品| 久久亚洲精品一区二区| 久久久999精品免费| 欧美专区在线观看| 欧美一区二区三区视频免费| 亚洲影视在线| 午夜精品成人在线视频| 亚洲嫩草精品久久| 一区二区三区久久网| 一区二区黄色| 亚洲在线视频免费观看| 亚洲一区二区成人| 亚洲一区免费在线观看| 亚洲欧美成人综合| 午夜老司机精品| 欧美一区二区三区播放老司机| 欧美一区二区三区的| 久久丁香综合五月国产三级网站| 久久国内精品自在自线400部| 久久久精品免费视频| 毛片av中文字幕一区二区| 欧美国产欧美亚洲国产日韩mv天天看完整 | 久久av一区二区三区| 久久久青草婷婷精品综合日韩 | 亚洲欧洲午夜| 国产精品99久久久久久人 | 亚洲精品一区二区在线| 一本一本久久a久久精品综合妖精 一本一本久久a久久精品综合麻豆 | 亚洲国产精品久久久久| 亚洲乱码一区二区| 亚洲综合导航| 久久午夜视频| 日韩视频免费观看高清在线视频| 中文国产亚洲喷潮| 久久久91精品国产一区二区精品| 欧美高清在线| 国产热re99久久6国产精品| 一区二区三区在线视频观看| 亚洲精品小视频在线观看| 亚洲一区二区成人在线观看| 久久久www| 亚洲高清不卡在线观看| 亚洲一区中文| 欧美成人精品不卡视频在线观看 | 久久福利视频导航| 免费在线观看成人av| 欧美日韩小视频| 国产一区二区三区四区| 99精品国产福利在线观看免费| 欧美一区二区大片| 91久久午夜| 欧美一区二区免费| 欧美日韩高清在线观看| 国产亚洲精品aa| 制服诱惑一区二区| 麻豆成人在线| 亚洲欧美一区二区激情| 欧美成年网站| 一区二区在线视频观看| 中日韩美女免费视频网址在线观看 | 欧美国产欧美综合| 午夜综合激情| 国产精品扒开腿爽爽爽视频 | 一区二区电影免费观看| 男女av一区三区二区色多| 午夜精品999| 国产精品国产三级欧美二区 | 精品福利av|