Lake Counting(poj 2386)】的更多相关文章

题目描述: Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains either water ('W') or dry land ('.'). F…
Lake Counting(POJ No.2386) Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains either water ('W')…
有一个大小为N*M的园子,雨后积起了水,八连通的积水被认为是链接在一起的求出园子里一共有多少水洼? *** *W* *** /** *进行深度优先搜索,从第一个W开始,将八个方向可以到达的 W修改为 . *每次进行深度优先搜索的时候就将链接的水坑换成了. *进行的深度优先搜索的次数就是水坑数 */ #include<stdio.h> #include<string.h> ; int N,M; char filed[MAX][MAX]; //园子的构造 //现在的位置(x,y) vo…
Lake Counting Time Limit: 1000MS     Memory Limit: 65536K Total Submissions: 17917     Accepted: 9069 Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <=…
Lake Counting Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 28966   Accepted: 14505 Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 10…
Lake Counting Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains either water ('W') or dry land…
Lake Counting Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 48370 Accepted: 23775 Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1…
Lake Counting Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 40370   Accepted: 20015 Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 10…
Lake Counting Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 18201   Accepted: 9192 Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100…
Lake Counting Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20003   Accepted: 10063 Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 10…
-->Lake Counting 直接上中文了 Descriptions: 由于近日阴雨连天,约翰的农场中中积水汇聚成一个个不同的池塘,农场可以用 N x M (1 <= N <= 100; 1 <= M <= 100) 的正方形来表示.农场中的每个格子可以用'W'或者是'.'来分别代表积水或者土地,约翰想知道他的农场中有多少池塘.池塘的定义:一片相互连通的积水.任何一个正方形格子被认为和与它相邻的8个格子相连. 给你约翰农场的航拍图,确定有多少池塘 Input Line 1…
Lake Counting Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 53301   Accepted: 26062 Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 10…
来之不易的2017第一发ac http://poj.org/problem?id=2386 Lake Counting Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 31474   Accepted: 15724 Description Due to recent rains, water has pooled in various places in Farmer John's field, which is repr…
Lake Counting 描述 Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains either water ('W') or dry land ('.'). Fa…
1751: [Usaco2005 qua]Lake Counting Time Limit: 5 Sec  Memory Limit: 64 MB Submit: 168  Solved: 130 [Submit][Status] Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x…
题目 3385: [Usaco2004 Nov]Lake Counting 数池塘 Time Limit: 1 Sec  Memory Limit: 128 MB Description     农夫约翰的农场可以表示成N×M(1≤N,M≤100)个方格组成的矩形.由于近日的降雨, 在约翰农场上的不同地方形成了池塘.每一个方格或者有积水(’W’)或者没有积水(’.’).农夫约翰打算数出他的农场上共形成了多少池塘.一个池塘是一系列相连的有积水的方格,每一个方格周围的八个方格都被认为是与这个方格相连…
3385: [Usaco2004 Nov]Lake Counting 数池塘 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 22  Solved: 21[Submit][Status][Discuss] Description     农夫约翰的农场可以表示成N×M(1≤N,M≤100)个方格组成的矩形.由于近日的降雨, 在约翰农场上的不同地方形成了池塘.每一个方格或者有积水(’W’)或者没有积水(’.’).农夫约翰打算数出他的农场上共形成了多少池…
1751: [Usaco2005 qua]Lake Counting Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 190  Solved: 150[Submit][Status][Discuss] Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle…
题目链接 https://www.luogu.org/problemnew/show/P1596 题目描述 Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains eit…
Lake Counting Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 49414   Accepted: 24273 Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 10…
题目链接: NOI题库http://noi.openjudge.cn/ch0205/1388/ POJ 2386 http://poj.org/problem?id=2386 总时间限制: 1000ms  内存限制: 65536kB 描述 Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <=…
Lake Counting Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 35122 Accepted: 17437 Description Due to recent rains, water has pooled in various places in Farmer John’s field, which is represented by a rectangle of N x M (1 <= N <= 100; 1…
http://blog.csdn.net/c20182030/article/details/52327948 1388:Lake Counting 总时间限制:   1000ms   内存限制:   65536kB 描述 Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 1…
Lake Counting Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20782   Accepted: 10473 Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 10…
P1596 [USACO10OCT]湖计数Lake Counting 题目描述 Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains either water ('W'…
http://poj.org/problem?id=2386 http://acm.hdu.edu.cn/showproblem.php?pid=1241 求有多少个连通子图.复杂度都是O(n*m). #include <cstdio> ][]; int n,m; void dfs(int x,int y) { ;i<=;i++) ;j<=;j++) //循环遍历8个方向 { int xx=x+i,yy=y+j; &&xx<n&&yy>=…
题目链接:http://poj.org/problem?id=2386 分析:八联通的则为水洼,我们则需遍历一个单位附近的八个单位并将它们都改成'.',但附近单位可能仍连接着有'W'的区域,这种情况下我们应该用dfs遍历到尽头,并将这些联通的W全部改掉,1此dfs后与初始的这个W连接的所有W都替换成了'.',因此直到图中不再存在W为止,最后执行dfs的次数即为水洼的个数. #include <iostream> using namespace std; int n,m; ][]; void d…
http://poj.org/problem?id=2386 题目大意: 有一个大小为N*M的园子,雨后积起了水.八连通的积水被认为是连接在一起的.请求出院子里共有多少水洼? 思路: 水题~直接DFS,DFS过程把途中表示水洼的W改为'.',看DFS了几次即可. #include<cstdio> #include<cstring> const int MAXN=100+10; char map[MAXN][MAXN]; int n,m; void dfs(int x,int y)…
链接:http://poj.org/problem?id=2386 题解 #include<cstdio> #include<stack> using namespace std; ,MAX_N=; char a[MAX_N][MAX_M]; int N,M; //现在位置 (x,y) void dfs(int x,int y){ a[x][y]='.'; //将现在所在位置替换为'.',即旱地 ;dx<=;dx++){ //循环遍历连通的8个方向:上.下.左.右.左上.左下…
地址 http://poj.org/problem?id=2386 <挑战程序设计竞赛>习题 题目描述Description Due to recent rains, water has pooled in various places in Farmer John’s field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each squa…