1751: [Usaco2005 qua]Lake Counting (搜索)
来源:互联网 发布:淘宝免单群是什么意思 编辑:程序博客网 时间:2024/05/16 01:30
#include<iostream>#include<cstring>using namespace std;int m,n,sum=0;char mapi[101][101];bool map[101][101];void clean(int x,int y){ if(x<=0||y<=0||x>m||y>n)return; if(map[x][y]==0)return; else { map[x][y]=0; clean(x+1,y); clean(x,y+1); clean(x-1,y); clean(x,y-1); clean(x+1,y+1); clean(x+1,y-1); clean(x-1,y-1); clean(x-1,y+1); return; }}int main(){ memset(map,0,sizeof(map)); cin>>m>>n; for(int i=1;i<=m;i++) for(int j=1;j<=n;j++) { cin>>mapi[i][j]; map[i][j]=(mapi[i][j]!='.'); } for(int i=1;i<=m;i++) for(int j=1;j<=n;j++) if(map[i][j]!=0) { sum++; clean(i,j); } cout<<sum; return 0;}
0 0
- 1751: [Usaco2005 qua]Lake Counting (搜索)
- bzoj 1751 [Usaco2005 qua]Lake Counting
- bzoj1751 [Usaco2005 qua]Lake Counting
- bzoj1751 [Usaco2005 qua]Lake Counting
- [bzoj1751][Usaco2005 qua]Lake Counting
- 搜索(A - Lake Counting)
- Lake Counting --- 深度优先搜索
- POJ 2386 Lake Counting 搜索题解
- DFS深度优先搜索之lake counting
- POJ-2386Lake Counting,搜索题。。
- poj2386——Lake Counting(搜索)
- Lake Counting(搜索之DFS)
- lake counting---dfs(深度搜索算法)
- bzoj1754 [Usaco2005 qua]Bull Math
- bzoj1755 [Usaco2005 qua]Bank Interest
- 1755: [Usaco2005 qua]Bank Interest
- bzoj1750 [Usaco2005 qua]Apple Catching
- bzoj1755 [Usaco2005 qua]Bank Interest
- Hadoop -YARN ResourceManager 剖析
- Keil (MDK)中变量定义位置
- 768038122----骗子
- Linux下C编程:进程间通信(IPC)总结
- Two Sum && 3 Sum
- 1751: [Usaco2005 qua]Lake Counting (搜索)
- 堆排序
- 开源夏令营之项目汇报2
- 《Head First 设计模式》之简单工厂
- Python urllib模块与urlopen()函数解析偎
- 学习CSS了解单位em和px的区别
- git使用之分支理解、删除本地分支、删除远程分支
- hdu1214 圆桌会议(数学:题意难懂+水题)
- 【读书笔记】【收获,不止Oracle】索引组织表