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$ описывает строку $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.