QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 256 MB مجموع النقاط: 100

#22328. 最好的青草

الإحصائيات

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.