QOJ.ac

QOJ

Süre Sınırı: 2 s Bellek Sınırı: 256 MB Toplam puan: 100

#22742. عد البرك

İstatistikler

جمعت الأمطار الأخيرة الماء في حقل Farmer John، مستطيل $N \times M$ ($1 \le N \le 100$; $1 \le M \le 100$) خلايا. كل خلية ماء ('$W$') أو أرض جافة ('.'). يريد عدد البرك. البركة مجموعة متصلة من خلايا الماء؛ كل خلية مجاورة لكل الخلايا الثماني حولها.

من رسم الحقل احسب عدد البرك.

الإدخال

  • السطر 1: العددان الصحيحان $N$ و$M$ تفصل بينهما مسافة.

  • الأسطر $2..N+1$: $M$ محارف لكل صف، كل محرف '$W$' أو '.'، دون مسافات بينها.

الإخراج

  • السطر 1: عدد البرك في حقل Farmer John.

أمثلة

الإدخال 1

10 12
W........WW.
.WWW.....WWW
....WW...WW.
.........WW.
.........W..
..W......W..
.W.W.....WW.
W.W.W.....W.
.W.W......W.
..W.......W.

الإخراج 1

3

ملاحظة

شرح

ثلاث برك: أعلى اليسار، أسفل اليسار، وعلى الجانب الأيمن.

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.