QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 256 MB Points totaux : 100

#22742. 연못 세기

Statistiques

최근 비로 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.