QOJ.ac

QOJ

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

#22328. Das beste Gras

Statistics

Bessie plant einen Tag mit zartem Frühlingsgras und betrachtet die Weide, die Farmer John liebevoll in $R$ Zeilen ($(1 \le R \le 100)$) und $C$ Spalten ($(1 \le C \le 100)$) unterteilt hat. Sie möchte die Grasbüschel zählen.

Ein Büschel ist ein # oder zwei seitlich benachbarte #, aber nicht diagonal. Bestimme anhand der Karte ihre Zahl.

Zum Beispiel hat die folgende Karte $R$ gleich $5$ und $C$ gleich $6$:

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

Es gibt $5$ Büschel: eines in Zeile $1$; eines in Spalte $2$ über Zeilen $2$ und $3$; ein einzelnes in Zeile $3$; eines in Zeile $4$ über Spalten $4$ und $5$; noch eines in Zeile $5$.

Eingabe

  • Zeile $1$: durch Leerzeichen getrennte ganze Zahlen $R$ und $C$.

  • Zeilen $2,\ldots,R+1$: Zeile $i+1$ beschreibt Feldzeile $i$ mit $C$ Zeichen, jeweils # oder ..

Ausgabe

  • Zeile $1$: eine ganze Zahl, die Anzahl essbarer Grasbüschel für Bessie.

Beispiele

Eingabe 1

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

Ausgabe 1

5

Aufgabenautor: 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.