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.