【OJ】Lake Counting (Poj 2386 // hzu.acmclub.com 11448)
来源:互联网 发布:淘宝夏季情侣装 编辑:程序博客网 时间:2024/06/06 15:41
#include<iostream>#include<stdio.h>using namespace std;int n,m,ans=0;char f[101][101];void dfs(int r,int c){f[r][c]='.';for(int dr=-1;dr<=1;dr++)for(int dc=-1;dc<=1;dc++){int rr=r+dr,cc=c+dc;if(rr>=1&&rr<=n&&cc>=1&&cc<=m&&f[rr][cc]=='W')dfs(rr,cc);}}int main(){//freopen("in.txt","r",stdin);cin>>n>>m;getchar();for(int i=1;i<=n;i++){for(int j=1;j<=m;j++)f[i][j]=getchar();getchar();}for(int i=1;i<=n;i++)//intfor(int j=1;j<=m;j++){if(f[i][j]=='W'){dfs(i,j);ans++;}}cout<<ans<<endl;return 0;
<a target=_blank href="http://hzu.acmclub.com/index.php?app=problem_title&id=538&problem_id=11448">Lake Counting (hzu.acmclub.com 11448)</a>
0 0
- 【OJ】Lake Counting (Poj 2386 // hzu.acmclub.com 11448)
- 【OJ】贪心——区间问题 hzu.acmclub.com 1126看电视
- 【OJ】排列 n! STL函数next_permutation // Anagram / hzu.acmclub.com10317 / poj 1256
- 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
- 找工作--笔试面试--准备8
- bombing:cocos2d-x内存管理机制-侧重调用
- CodeForces-228A-Is your horseshoe on the other hoof?
- 基于C++的灰度值方图处理
- [LeetCode]Merge Intervals
- 【OJ】Lake Counting (Poj 2386 // hzu.acmclub.com 11448)
- hibernate配置文件中的properties元素
- CodeForces-271A-Beautiful Year
- git基本操作
- block 1
- 框架学习六:ViewPagerIndicator
- DSP是什么
- nyoj.2 括号配对问题 20141014
- Android使用FileInputStream和FileOutputStream进行文件I/O操作