当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3917:Rock, Paper, Scissors

题目描述
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:

RockbeatsScissors
PaperbeatsRock
ScissorsbeatsPaper


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.
输入解释
The input contains between 1 and 20 pairs of lines, the first for Player 1 and the second for Player 2. Both player lines contain the same number of symbols from the set {'R', 'P', 'S'}. The number of symbols per line is between 1 and 75, inclusive. A pair of lines each containing the single character 'E' signifies the end of the input.
输出解释
For each pair of input lines, output a pair of output lines as shown in the sample output, indicating the number of games won by each player.
输入样例
RRSRS
SRSPS
PPP
SSS
SPPSRR
PSPSRS
E
E
输出样例
P1: 1
P2: 1
P1: 0
P2: 3
P1: 2
P2: 1

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Mid-Central USA 2009

源链接: POJ-3917

最后修改于 2020-10-29T07:15:28+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536