QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 256 MB 總分: 100

#22742. ספירת בריכות

统计

גשמים אחרונים אספו מים בשדה 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.