POJ 2386 Lake Counting
来源:互联网 发布:电子商务模拟教学软件 编辑:程序博客网 时间:2024/05/01 22:53
题略水- -!
#include<stdio.h>#include<string.h>#include<stdlib.h>char s[110][110];bool vis[110][110];int n,m;void dfs(int x,int y){ if(x<n&&x>=0&&y<m&&y>=0&&s[x][y]=='W'&&!vis[x][y]) { vis[x][y]=true; dfs(x+1,y); dfs(x+1,y+1); dfs(x+1,y-1); dfs(x,y+1); dfs(x,y-1); dfs(x-1,y); dfs(x-1,y+1); dfs(x-1,y-1); }}int main(){ int i,j,ans; // freopen("test.txt", "r", stdin); while(scanf("%d%d",&n,&m)!=EOF) { getchar(); ans=0; memset(vis,0,sizeof(vis)); for(i=0;i<n;i++) gets(s[i]); for(i=0;i<n;i++) for(j=0;j<m;j++) if(s[i][j]=='W'&&!vis[i][j]) { ans++; dfs(i,j); } printf("%d\n",ans); } return 0;}
- poj 2386 Lake Counting
- poj 2386 Lake Counting
- POJ 2386 Lake Counting
- poj 2386 Lake Counting
- poj 2386 Lake Counting
- poj 2386 Lake Counting
- POJ 2386 Lake Counting
- poj 2386 Lake Counting
- POJ 2386 Lake Counting
- POJ 2386 Lake Counting
- poj 2386 Lake Counting
- POJ 2386 Lake Counting
- POJ 2386 Lake Counting
- POJ-2386-Lake Counting
- POJ 2386 Lake Counting
- poj 2386 Lake Counting
- Poj 2386 Lake Counting
- poj 2386 Lake Counting
- 网页的色彩搭配
- 去掉博客首页任意部位的代码
- intellij+grails
- 如何在进程之间传递文件描述符(file discriptor)
- 驱动开发调试环境配置
- POJ 2386 Lake Counting
- 使用正则表达式找出不包含特定字符串的条目
- android延迟的几种方法
- IOS MVC设计模式的理解
- zz GCC g++安装
- POJ 2488 DFS+记录路径 TOJ 3520 BFS+记录路径
- Oracle中分段查询rownum
- 实现业务系统中的用户权限管理--设计篇
- MIT操作系统实验1-2