Preparing NOJ
Rock, Paper, Scissors is a classic hand game for two people. Each participant holds out either a fist (rock), open hand (paper), or two-finger V (scissors). If both players show the same gesture, they try again. They continue until there are two different gestures. The winner is then determined according to the table below:
Rock beats Scissors
Paper beats Rock
Scissors beats Paper
Your task is to take a list of symbols representing the gestures of two players and determine how many games each player wins.
In the following example:
Turn : 1 2 3 4 5
Player 1 : R R S R S
Player 2 : S R S P S
Player 1 wins at Turn 1 (Rock beats Scissors), Player 2 wins at Turn 4 (Paper beats Rock), and all the other turns are ties.
RRSRS
SRSPS
PPP
SSS
SPPSRR
PSPSRS
E
E
P1: 1
P2: 1
P1: 0
P2: 3
P1: 2
P2: 1
本题由旧版NOJ导入,来源:ACM Mid-Central Regional 2009