国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發(fā)設計 > 正文

hdu 1312

2019-11-08 02:42:52
字體:
供稿:網(wǎng)友
////  main.cpp//  dfs-bfs搜索////  Created by liuzhe on 16/8/10.//  Copyright © 2016年 my_code. All rights reserved.//#include <iostream>#include <algorithm>#include <cstdio>#include <cstring>using namespace std;int w,h;char z[21][21];int dfs(int i,int j){    if(i<1||j<1||i>h||j>w)        return 0;    if(z[i][j]!='#')    {        z[i][j]='#';        return 1+dfs(i-1,j)+dfs(i+1,j)+dfs(i,j-1)+dfs(i,j+1);    }    else        return 0;}int main(int argc, const char * argv[]) {    // insert code here...    while(cin>>w>>h)    {        if(!w&&!h)            break;        for(int i=1;i<=h;i++)            for(int j=1;j<=w;j++)                cin>>z[i][j];        for(int i=1;i<=h;i++)            for(int j=1;j<=w;j++)                if(z[i][j]=='@')                    cout<<dfs(i,j)<<endl;    }        //std::cout << "Hello, World!/n";    return 0;}
上一篇:Circular Sequence

下一篇:pyhton套件 Jupyter

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 象山县| 大英县| 顺平县| 黑水县| 安岳县| 开阳县| 依兰县| 松原市| 龙泉市| 灌云县| 江山市| 黑河市| 乌拉特中旗| 澄城县| 万宁市| 灵宝市| 伊通| 台山市| 读书| 安陆市| 漳平市| 贡嘎县| 开鲁县| 莲花县| 长岛县| 万州区| 科技| 寻甸| 新平| 丹棱县| 华蓥市| 巴彦县| 陇川县| 南丹县| 延吉市| 县级市| 德钦县| 县级市| 芒康县| 龙山县| 乐亭县|