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

5352번 - Coin Collection 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB71645194.444%

문제

Coins are placed on the squares of an nxm board, with no more than one coin per square. A robot, located in the upper left square of the board, needs to collect as many coins as possible and bring them to the bottom right square. On each step the robot can move either one cell to the right or one cell down from its current location. When the robot visits a cell with a coin, it always picks up the coin. Design an algorithm to find the maximum number of coins the robot can collect.

For example, given the 5x7 board below the robot can collect at most 6 coins.

입력

The first line of input will be a positive integer indicating the number of problem sets. Each problem set will start with a line that has two positive integers, n ≤ 50 and m ≤ 50, which represent the board size. The next n lines will contain m characters that are either an X or C. The X will represent a blank and the C a coin. Thus, the example 5x7 board above is represented by problem set

5 7
CXXXXCC
XCCCXXX
XXXXXXC
CXCCXXX
XCXXXCX

출력

For each problem set print, on a separate line, the maximum number of coins the robot can collect.

제한

예제 입력 1

2
5 7
CXXXXCC
XCCCXXX
XXXXXXC
CXCCXXX
XCXXXCX
4 4
XXXX
CCCC
XXXX
CCCC

예제 출력 1

6
5

힌트

출처

School > PLU High School Programming Contest > PLU 2013 > Advanced 10번

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

출처

대학교 대회

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

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