21396_Rock,Scissors,Paper

2022-5-16 18:19| 发布者: Hocassian| 查看: 56| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505230551799-Problem List-采集的数据-后羿采集器.html

Pro.ID

21396

Title

Rock, Scissors, Paper

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21396

AC

26

Submit

63

Ratio

41.27%

时间&空间限制

  • Time Limit: 3000/1000 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    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.

    输出

    Description
    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.
    Input
    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.
    Output
    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.
    Sample Input
    2
    3 3 1
    RRR
    RSR
    RRR
    3 4 2
    RSPR
    SPRS
    PRSP
    Sample Output
    RRR
    RRR
    RRR
    
    RRRS
    RRSP
    RSPR
    Source

    样例输入

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

    样例输出

    RRR
    RRR
    RRR
    
    RRRS
    RRSP
    RSPR

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部