Huawei OD machine test - Rock, paper, scissors game (Java & JS & Python & C)

Question description

The rock-paper-scissors game has 3 punch shapes: rock, scissors, and paper. Represented by letters A, B, and C respectively.

game rules:

  1. The winning and losing rules between punching shapes are as follows:

    A > B;
    B > C;
    C > A;

    ">" A letter on the left indicates the relative advantage shape. A letter on the right indicates a relatively disadvantaged shape.
     
  2. When there is and is only one punching shape that is better than other punching shapes in this round, the player with this shape is the winner. Otherwise it is considered a draw.

    Example 1: Three players punch A, B, and C respectively. Due to a three-way advantage cycle (i.e. no one is better than the other puncher), it is judged to be a draw.

    Example 2: Three players punch A, B, and B respectively. The one who punches A wins.

    Example 3: All three players punched A. It was ruled a draw.
     
  3. When a tie occurs, there is no winner. When there are multiple winners, both are winners.

Enter description

In a game, each player has one line of information. The number of players does not exceed 1,000. Each player information has 2 fields, separated by spaces;

  1. Player ID: a string consisting only of English letters and numbers
  2. Punch shape: represented by English capital letters, A, B, C shapes.
  3. Punch time: positive integer, the smaller it is, the earlier the time is

For example:

abc1 A
xyz B

Explanation: Player a

Guess you like

Origin blog.csdn.net/qfc_128220/article/details/134725034