QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22328. 最好的青草

Statistics

Bessie 计划一天吃嫩春草,望着 Farmer John 精心划成 $R$ 行($(1 \le R \le 100)$)、$C$ 列($(1 \le C \le 100)$)的牧场网格,想数草丛数量。

每丛在地图上是一个 #,或两个上下或左右相邻的 #(不沿对角线)。给定地图,告诉 Bessie 草丛数量。

例如下面的地图,$R$ 为 $5$、$C$ 为 $6$:

.#....
..#...
..#..#
...##.
.#....

共 $5$ 丛:第 $1$ 行一丛;第 $2$ 列跨第 $2$、$3$ 行一丛;第 $3$ 行独立一丛;第 $4$ 行跨第 $4$、$5$ 列一丛;第 $5$ 行又一丛。

输入格式

  • 第 $1$ 行:空格分隔的整数 $R$ 和 $C$。

  • 第 $2,\ldots,R+1$ 行:第 $i+1$ 行以 $C$ 个字符描述网格第 $i$ 行,每个字符为 # 或 .。

输出格式

  • 第 $1$ 行:一个整数,Bessie 可吃的草丛数量。

样例

输入格式 1

5 6
.#....
..#...
..#..#
...##.
.#....

输出格式 1

5

出题人:Rob Kolstad,2008

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.