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

20721번 - Safe Squares 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB1261129689.720%

문제

Penny is a young, enthusiastic pawn with significant ambitions. She hopes to improve her currently measly ranking and one day become queen of her entire chess board! Unfortunately, the current queen prefers the pawns of her kingdom do nothing but her bidding and views Penny's ambitions as a potential source of rebellion. She sends her loyal rooks onto the board to capture Penny and bring her before the royal court to face punishment.

Penny obviously does not want to be captured by the queen's rooks, but she does not know the safe spots on the board to escape to. If she goes to any square that is in the same row or same column as a rook, the rook will capture her! Given the locations of all the rooks, tell Penny how many squares there are on the chess board where she would be safe from the rooks!

입력

The input consists of 8ドル$ lines that each contain exactly 8ドル$ characters. Each line represents one row of the chessboard, and contains only R and . characters. The R characters are squares which contain a rook and the . characters represent empty squares.

출력

Print the number of squares on the chess board where Penny is safe from the rooks: where no rook is in the same row or column as the square. Note that there may be no safe squares (because the entire board is filled with rooks, or because every empty square is in the same row or column as a rook) in which case you should print 0.

제한

예제 입력 1

...R....
..R..R..
R.....R.
....R...
.R.....R
........
.....R..
R.......

예제 출력 1

0

예제 입력 2

.R......
..R.....
........
........
........
........
........
........

예제 출력 2

36

힌트

출처

University > UT Invitational Programming Contest > UT Invitational Programming Contest 2020 H번

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

출처

대학교 대회

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

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