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

4340번 - Rock, Scissors, Paper 다국어

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

문제

Bart's sister Lisa has created a new civilization on a two-dimensional grid. At the outset each grid location may be occupied by one of three life forms: Rocks, Scissors, or Papers. Each day, differing life forms occupying horizontally or vertically adjacent grid locations wage war. In each war, Rocks always defeat Scissors, Scissors always defeat Papers, and Papers always defeat Rocks. At the end of the day, the victor expands its territory to include the loser's grid position. The loser vacates the position.

Your job is to determine the territory occupied by each life form after n days.

입력

The first line of input contains t, the number of test cases. Each test case begins with three integers not greater than 100: r and c, the number of rows and columns in the grid, and n. The grid is represented by the r lines that follow, each with c characters. Each character in the grid is R, S, or P, indicating that it is occupied by Rocks, Scissors, or Papers respectively.

출력

For each test case, print the grid as it appears at the end of the nth day. Leave an empty line between the output for successive test cases.

제한

예제 입력 1

2
3 3 1
RRR
RSR
RRR
3 4 2
RSPR
SPRS
PRSP

예제 출력 1

RRR
RRR
RRR
RRRS
RRSP
RSPR

힌트

출처

Contest > Waterloo's local Programming Contests > 25 January, 2003 E번

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

출처

대학교 대회

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

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