Logo
(追記) (追記ここまで)

26549번 - Holes 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB2241038342.564%

문제

After receiving an impenetrable box, you wonder what’s inside! Write a program that finds out how many different disconnected sections the box has, and the total area of the space within the box.

입력

The first line will contain a single integer n that indicates the number of data sets that follow. Each data set will start with two integers r and c representing the number of rows and columns of the box, respectively. The next r lines will represent the box, with # representing walls and . representing spaces. The box will be surrounded entirely by walls.

출력

Output the number of discrete (disconnected) sections and the total number of spaces in the box, in the format shown in the example output.

제한

예제 입력 1

2
4 8
########
#...#..#
#.#.#..#
########
3 3
###
#.#
###

예제 출력 1

2 sections, 9 spaces
1 section, 1 space

힌트

출처

School > PLU High School Programming Contest > PLU 2018 > Novice 6번

School > PLU High School Programming Contest > PLU 2018 > Advanced 6번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /