3385: [Usaco2004 Nov]Lake Counting 数池塘
3385: [Usaco2004 Nov]Lake Counting 数池塘
Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 22 Solved: 21
[Submit][Status][Discuss]
Description
Input
Output
Sample Input
W ........ WW.
. WWW ..... WWW
.... WW ... WW.
......... WW.
......... W..
..W ...... W..
.W.W ..... WW.
W.W.W ..... W.
.W.W ...... W.
..W ....... W.
Sample Output
HINT
共有3个池塘:一个在左上角,一个在左下角,还有一个沿着右边界
Source
题解:一开始居然WA了一下,结果发现子程序里面忘申请局部变量i了TT
别的实在没了,直接灌水秒之,不明白这个为啥也能成为金组。。。不过貌似NOV2004只有金组的= =
/**************************************************************
Problem:
User: HansBug
Language: Pascal
Result: Accepted
Time: ms
Memory: kb
****************************************************************/ const dir:array[..,..] of longint=((,),(,-),(,),(-,),(,-),(-,),(,),(-,-));
var
i,j,k,l,m,n,ans:longint;
ch:char;
a:array[..,..] of longint;
procedure floodfill(x,y:longint);
var i:longint;
begin
if a[x,y]= then exit;
a[x,y]:=;
for i:= to do
if a[x+dir[i,],y+dir[i,]]= then floodfill(x+dir[i,],y+dir[i,]);
end;
begin
readln(n,m);
fillchar(a,sizeof(a),);
for i:= to n do
for j:= to m do
begin
read(ch);
if upcase(ch)='W' then a[i,j]:=;
if j=m then readln;
end;
ans:=;
for i:= to n do
for j:= to m do
if a[i,j]= then
begin
inc(ans);
floodfill(i,j);
end;
writeln(ans);
readln;
end.
3385: [Usaco2004 Nov]Lake Counting 数池塘的更多相关文章
- BZOJ 3385: [Usaco2004 Nov]Lake Counting 数池塘
题目 3385: [Usaco2004 Nov]Lake Counting 数池塘 Time Limit: 1 Sec Memory Limit: 128 MB Description 农夫 ...
- BZOJ2023: [Usaco2005 Nov]Ant Counting 数蚂蚁
2023: [Usaco2005 Nov]Ant Counting 数蚂蚁 Time Limit: 4 Sec Memory Limit: 64 MBSubmit: 56 Solved: 16[S ...
- 1630/2023: [Usaco2005 Nov]Ant Counting 数蚂蚁
2023: [Usaco2005 Nov]Ant Counting 数蚂蚁 Time Limit: 4 Sec Memory Limit: 64 MBSubmit: 85 Solved: 40[S ...
- bzoj2023[Usaco2005 Nov]Ant Counting 数蚂蚁*&&bzoj1630[Usaco2007 Demo]Ant Counting*
bzoj2023[Usaco2005 Nov]Ant Counting 数蚂蚁&&bzoj1630[Usaco2007 Demo]Ant Counting 题意: t个族群,每个族群有 ...
- bzoj1630 / bzoj2023 [Usaco2005 Nov]Ant Counting 数蚂蚁
Description 有一天,贝茜无聊地坐在蚂蚁洞前看蚂蚁们进进出出地搬运食物.很快贝茜发现有些蚂蚁长得几乎一模一样,于是她认为那些蚂蚁是兄弟,也就是说它们是同一个家族里的成员.她也发现整个 ...
- BZOJ2023: [Usaco2005 Nov]Ant Counting 数蚂蚁(dp)
题意 题目描述的很清楚... 有一天,贝茜无聊地坐在蚂蚁洞前看蚂蚁们进进出出地搬运食物.很快贝茜发现有些蚂蚁长得几乎一模一样,于是她认为那些蚂蚁是兄弟,也就是说它们是同一个家族里的成员.她也发现整个 ...
- BZOJ 2023 [Usaco2005 Nov]Ant Counting 数蚂蚁:dp【前缀和优化】
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2023 题意: 有n个家族,共m只蚂蚁(n <= 1000, m <= 1000 ...
- 【bzoj2023/1630】[Usaco2005 Nov]Ant Counting 数蚂蚁 dp
题解: 水题 f[i][j] 前i种用了j个,前缀和优化就可以了
- bzoj 2023: [Usaco2005 Nov]Ant Counting 数蚂蚁【生成函数||dp】
用生成函数套路推一推,推完老想NTT--实际上把这个多项式乘法看成dp然后前缀和优化一下即可 #include<iostream> #include<cstdio> using ...
随机推荐
- List与Linkedlist、Arrylist、Vector、Map应用
1.List与LinkedList List是数组链表 LinkedList是指针链表 选择List还是LinkedList要看你的使用特点. 数组链表访问快,复 ...
- 在DataTable数据类型最后增加一列,列名为“Column”,内容都为“AAA”
DataTable dt = new DataTable(); dt.Columns.Add("Column", typeof(string)); foreach (DataRow ...
- C# winform初学者实例
快递单打印通 下载地址: http://pan.baidu.com/s/1nue5ifn
- 6.00.1x Introduction to computation
6.00 Introduction to Computer Science and Programming • Goal: –Become skillful at ...
- pytho查找斐波那契序列中的值
''' 实现斐波那契序列,查找其中第N个数的值 ''' def FeiBSequence(list,N): length=len(list); i=0; while i<length: if N ...
- 华为oj---合并数组
题目标题: 将两个整型数组按照升序合并,并且过滤掉重复数组元素 详细描述: 接口说明 原型: voidCombineBySort(int* pArray1,intiArray1Num,int* pAr ...
- [CSS3] 学习笔记-CSS3选择器详解(一)
1.属性选择器 在CSS3中,追加了3个属性选择器,分别为:[att*=val].[att^=val]和[att$=val],使得属性选择器有了通配符的概念. <!doctype html> ...
- loadrunner解决浏览器死机问题
初次接触loadrunner时,遇到很多问题.浏览器崩溃以及录不到脚本就折磨了一周时间.最后终于解决 一.浏览器崩溃问题 1.退出安全卫士和防火墙 2.去掉IE第三方扩展.工具-Internet选项- ...
- 时间处理之strtotime
strtotime (PHP 4, PHP 5, PHP 7)strtotime - 将任何英文文本的日期时间描述解析为 Unix 时间戳说明 int strtotime ( string $time ...
- [UWP]依赖属性2:使用依赖属性
5. 完整的自定义依赖属性 5.1 定义 /// <summary> /// 标识 Title 依赖属性. /// </summary> public static reado ...