Huawei OD Computer Test Real Questions-Rock-Paper-Scissors Game-2023 OD Unified Examination (Paper C)

Topic description:

The rock-paper-scissors game has three 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 to the left of ">" 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 that shape is the winner. Otherwise it is considered a draw.

  For 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.

  For example, there are three players, punching A and B respectively. The one who punches A wins. 

  For example, there are three players, and all punches are A. Judged as 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. 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 abc1 punches a stone (A). Player xyz punches scissors (B)

Output description:

Output the list of player IDs that are winners (a

Guess you like

Origin blog.csdn.net/2301_76848549/article/details/135284254