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)$). היא רוצה לספור גושי עשב.

כל גוש מוצג כ־# אחד או שני # שכנים בצלע, לא באלכסון. לפי המפה אמרו לה כמה גושים יש.

למשל במפה הבאה $R$ שווה $5$ ו־$C$ שווה $6$:

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

יש $5$ גושים: אחד בשורה $1$; אחד בעמודה $2$ על שורות $2$ ו־$3$; אחד בודד בשורה $3$; אחד בשורה $4$ על עמודות $4$ ו־$5$; ועוד אחד בשורה $5$.

קלט

  • שורה $1$: השלמים $R$ ו־$C$ מופרדים ברווח.

  • שורות $2,\ldots,R+1$: שורה $i+1$ מתארת את שורה $i$ בשדה באמצעות $C$ תווים, כל אחד # או ..

פלט

  • שורה $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.