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

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>
            久久久亚洲高清| 久热精品视频在线| 国产精品久久久久av免费| 一区二区精品在线| 99精品欧美一区二区蜜桃免费| 欧美激情网友自拍| 亚洲视频一区在线观看| 亚洲丝袜av一区| 国产精品私拍pans大尺度在线 | 欧美日韩视频在线| 亚洲一区二区三区精品动漫| 一本色道88久久加勒比精品| 国产麻豆视频精品| 欧美成年人视频| 欧美了一区在线观看| 亚洲一区二区视频| 欧美一区二区三区四区在线观看地址 | 亚洲精品一二三| 欧美日韩亚洲成人| 久久精品人人爽| 免费欧美电影| 午夜精品视频一区| 老鸭窝毛片一区二区三区| 一区二区三区av| 午夜久久久久久久久久一区二区| 在线精品亚洲一区二区| 亚洲激情综合| 国产精品一区二区三区久久| 免费欧美日韩| 国产精品理论片在线观看| 久久在精品线影院精品国产| 欧美激情二区三区| 久久精品一区二区三区不卡| 欧美精品少妇一区二区三区| 欧美在现视频| 欧美日韩三区四区| 毛片一区二区| 国产麻豆9l精品三级站| 亚洲日韩欧美一区二区在线| 国产在线精品自拍| 一区二区三区产品免费精品久久75 | 亚洲欧美国内爽妇网| 99riav久久精品riav| 久久精品一区二区三区四区| 亚洲午夜在线| 欧美精品三级日韩久久| 老司机精品久久| 国产欧美一区二区三区在线看蜜臀| 欧美国产精品人人做人人爱| 国产欧美亚洲一区| 夜夜夜久久久| 一区二区三区免费网站| 久久亚洲私人国产精品va| 久久精品在线观看| 国产精品一区二区三区观看| 亚洲免费av网站| 亚洲七七久久综合桃花剧情介绍| 午夜精品一区二区三区电影天堂| 亚洲美女中出| 免费影视亚洲| 欧美电影在线| 91久久精品日日躁夜夜躁国产| 久久aⅴ国产欧美74aaa| 欧美一区二区三区四区在线观看地址 | 亚洲五月六月| 亚洲中字在线| 国产精品美女久久久| 亚洲免费av片| 亚洲一区二区免费| 欧美色中文字幕| 亚洲手机视频| 午夜精品免费视频| 国产日韩精品一区二区三区在线| 亚洲性视频h| 欧美一区二区视频网站| 国产精品视频网站| 先锋影音网一区二区| 久久精品国产亚洲aⅴ| 国产在线一区二区三区四区| 久久av一区二区三区亚洲| 久久人91精品久久久久久不卡| 国产一区二区三区免费观看| 久久精品99| 欧美国产精品人人做人人爱| 日韩视频免费看| 国产精品久久久久久久久借妻 | 久久综合给合久久狠狠色| 亚洲第一精品久久忘忧草社区| 老妇喷水一区二区三区| 亚洲精品免费电影| 欧美一激情一区二区三区| 国产欧美三级| 欧美国产免费| 亚洲一区二区三区精品动漫| 久久精品一区二区国产| 亚洲精品美女在线观看| 国产精品女人网站| 久久久九九九九| 日韩视频亚洲视频| 欧美一级专区免费大片| 一区二区三区自拍| 欧美精品久久久久久久久老牛影院| 一区二区免费在线观看| 久久综合激情| 亚洲免费在线播放| 亚洲国产一区二区三区青草影视 | 亚洲欧美日韩国产成人| 欧美激情小视频| 欧美一区二区黄| 亚洲精品久久久久| 国产亚洲福利| 欧美日韩三级视频| 久热精品视频在线免费观看| 一区二区三区四区五区视频| 麻豆精品网站| 欧美一区免费| 一级成人国产| 亚洲国产精品一区二区www在线| 国产精品国产三级国产专播精品人 | 国产精品日本一区二区| 噜噜噜在线观看免费视频日韩| 一区二区三区四区五区在线| 欧美福利一区二区| 久久久999成人| 亚洲影视九九影院在线观看| 亚洲国产精品久久久久婷婷884| 国产精品视频网址| 欧美日韩一区在线播放| 老鸭窝91久久精品色噜噜导演| 午夜免费日韩视频| 一区二区精品国产| 91久久精品日日躁夜夜躁国产| 久久久精品日韩欧美| 亚洲欧美日韩国产综合在线 | 中日韩美女免费视频网址在线观看| 黄色成人在线免费| 国产美女精品视频| 国产精品美女久久久久av超清| 欧美激情综合亚洲一二区| 久久一区二区精品| 久久久久久久999| 欧美一区二区三区视频在线| 亚洲一区二区三区久久| 一个色综合导航| 99精品视频一区| 一本色道**综合亚洲精品蜜桃冫 | 亚洲国产精品第一区二区三区| 久久夜色精品国产欧美乱极品| 欧美专区中文字幕| 久久国产精品久久久久久久久久| 亚洲欧美一区二区三区极速播放| 亚洲图片自拍偷拍| 亚洲天堂av高清| 亚洲一区二区在线播放| 亚洲四色影视在线观看| 亚洲欧美日韩成人| 先锋影音一区二区三区| 久久riav二区三区| 久久午夜电影| 欧美刺激性大交免费视频| 女仆av观看一区| 亚洲国产欧美不卡在线观看| 亚洲国产老妈| 一本色道久久99精品综合| 亚洲在线成人精品| 久久超碰97中文字幕| 乱人伦精品视频在线观看| 欧美激情综合网| 国产精品免费网站在线观看| 国产精品有限公司| 好吊妞**欧美| 99av国产精品欲麻豆| 亚洲一区二区三区四区五区黄 | 国产尤物精品| 亚洲欧洲另类国产综合| 一区二区三区视频在线看| 亚洲欧美清纯在线制服| 久久久久久久久久看片| 亚洲激情成人网| 亚洲男人的天堂在线| 久久精品亚洲精品| 欧美日韩大陆在线| 国产亚洲欧美激情| 亚洲美女av电影| 久久九九精品| 亚洲欧洲精品一区| 欧美亚洲日本国产| 欧美福利视频| 国内成人精品2018免费看 | 国产精品嫩草久久久久| 伊人久久综合| 亚洲欧美日韩高清| 欧美激情亚洲另类| 欧美一区二区三区久久精品| 欧美激情视频免费观看| 国产综合色在线| 欧美一级二区| av不卡在线看| 欧美大色视频| 亚洲二区在线视频|