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

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>
            一区二区三区视频观看| 伊人婷婷久久| 亚洲一区二区少妇| 亚洲激情视频在线播放| 久久一区二区三区四区五区| 一区精品在线播放| 欧美激情性爽国产精品17p| 久久乐国产精品| 亚洲日本中文字幕区| 最新国产乱人伦偷精品免费网站| 免费欧美日韩| 一区二区三区视频在线观看| 亚洲午夜一区二区| 国内偷自视频区视频综合| 久久先锋影音av| 欧美精品激情在线观看| 亚洲一区欧美二区| 欧美专区在线| 一本久道久久久| 亚洲一区3d动漫同人无遮挡| 国产欧美精品xxxx另类| 欧美激情网友自拍| 欧美视频福利| 美女视频黄免费的久久| 欧美日韩亚洲高清| 久久精品国产欧美亚洲人人爽| 久久久久久久久久久久久久一区| 一本久久综合亚洲鲁鲁| 午夜国产精品视频免费体验区| 在线播放中文字幕一区| 99视频精品在线| 亚洲电影免费在线| 一区二区久久久久| 在线看片第一页欧美| 一本色道婷婷久久欧美| 影音先锋欧美精品| 午夜精品影院| 日韩视频免费观看高清完整版| 欧美一级理论片| 一本一本久久a久久精品综合妖精| 欧美一级黄色网| 亚洲系列中文字幕| 美女脱光内衣内裤视频久久影院| 欧美一区二区三区在线播放| 欧美美女喷水视频| 欧美成人精品影院| 国产日韩专区| 亚洲男女自偷自拍图片另类| 这里只有精品电影| 欧美不卡视频| 欧美国产精品v| 激情欧美一区二区| 香港久久久电影| 亚洲综合首页| 欧美日韩在线免费| 亚洲第一在线综合网站| 国外成人网址| 久久激情视频久久| 久久激情视频| 国产日韩在线看片| 亚洲欧美日韩爽爽影院| 亚洲欧美三级伦理| 国产精品美女久久| 亚洲一区二区三区四区在线观看 | 亚洲最新在线视频| 久久乐国产精品| 免费不卡中文字幕视频| 影音先锋日韩精品| 久久久久久久综合| 欧美mv日韩mv国产网站| 亚洲国产精品黑人久久久| 久久精品国产99精品国产亚洲性色 | 日韩小视频在线观看专区| 欧美 日韩 国产精品免费观看| 免费亚洲网站| 亚洲黄一区二区三区| 免费成人激情视频| 欧美激情视频免费观看| 亚洲乱码国产乱码精品精| 欧美美女bb生活片| 在线综合欧美| 久久精品国产清自在天天线| 一区二区在线视频播放| 欧美成人中文字幕在线| 日韩亚洲精品视频| 午夜亚洲性色视频| 国产一区二区久久| 欧美.com| 亚洲男人第一网站| 免费在线一区二区| 一本久道久久综合婷婷鲸鱼| 国产精品美女一区二区在线观看| 亚洲欧美在线免费| 欧美www视频在线观看| 一本色道久久综合亚洲精品不卡 | 久久免费视频在线观看| 亚洲破处大片| 午夜精品一区二区三区在线播放| 国内外成人在线视频| 欧美激情久久久久| 亚洲免费小视频| 欧美成人日韩| 欧美一区二区三区免费观看| 亚洲国产精品999| 欧美性开放视频| 久久爱www| 亚洲日本中文字幕| 久久免费视频在线观看| 一区二区三区福利| 在线观看视频亚洲| 国产精品美女一区二区在线观看| 狂野欧美激情性xxxx| 亚洲视频你懂的| 亚洲国产毛片完整版| 久久精品国产一区二区电影| 亚洲毛片一区| 在线观看一区| 国产人成一区二区三区影院| 欧美精品久久一区二区| 久久久天天操| 亚洲欧美日韩网| 一区二区三区高清| 亚洲三级免费电影| 欧美国产激情| 美女999久久久精品视频| 在线亚洲伦理| 99re6热只有精品免费观看| 国外成人免费视频| 国产日韩综合| 国产精品午夜国产小视频| 欧美日韩国产成人在线免费| 久久影视三级福利片| 久久成人18免费观看| 亚洲欧美亚洲| 亚洲欧美色婷婷| 亚洲一区影院| 亚洲欧美区自拍先锋| 正在播放亚洲| 亚洲影视在线播放| 亚洲图片自拍偷拍| 亚洲精品视频免费在线观看| 亚洲国产一二三| 91久久久久| 91久久久亚洲精品| 亚洲电影免费在线观看| 欧美成在线视频| 欧美国产一区在线| 亚洲国产日韩在线一区模特| 欧美成人免费全部观看天天性色| 免费av成人在线| 欧美激情1区2区3区| 欧美高清你懂得| 亚洲成色999久久网站| 亚洲国产天堂网精品网站| 亚洲黄一区二区三区| 亚洲美女色禁图| 亚洲一级片在线观看| 欧美亚洲一区二区在线| 久久精品最新地址| 久久综合亚州| 欧美日韩亚洲一区二区三区四区| 欧美视频中文在线看| 国产精品视频1区| 伊人伊人伊人久久| 91久久夜色精品国产九色| 中文国产一区| 久久精品观看| 欧美成人亚洲成人| 一区二区三区高清视频在线观看| 午夜国产精品影院在线观看| 久久婷婷国产综合国色天香| 欧美极品在线观看| 国产日产欧美精品| 亚洲精品国精品久久99热一| 在线一区二区三区四区| 久久久九九九九| 亚洲欧洲一区| 欧美有码视频| 欧美久久久久免费| 国产亚洲在线| 夜夜嗨av一区二区三区四区| 欧美伊久线香蕉线新在线| 欧美丰满高潮xxxx喷水动漫| 中文有码久久| 久久人91精品久久久久久不卡| 欧美日本高清一区| 国产自产精品| 亚洲香蕉成视频在线观看| 久久一区二区三区国产精品| 一个色综合av| 欧美成人免费一级人片100| 国产精品色网| 在线亚洲自拍| 欧美韩国日本综合| 午夜视频在线观看一区| 欧美日韩国产一级片| 在线成人中文字幕| 欧美在线91| 国产精品99久久久久久www| 欧美大片国产精品|