CF48A.Rock-paper-scissors
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Uncle Fyodor, Matroskin the Cat and Sharic the Dog live their simple but happy lives in Prostokvashino. Sometimes they receive parcels from Uncle Fyodor’s parents and sometimes from anonymous benefactors, in which case it is hard to determine to which one of them the package has been sent. A photographic rifle is obviously for Sharic who loves hunting and fish is for Matroskin, but for whom was a new video game console meant? Every one of the three friends claimed that the present is for him and nearly quarreled. Uncle Fyodor had an idea how to solve the problem justly: they should suppose that the console was sent to all three of them and play it in turns. Everybody got relieved but then yet another burning problem popped up — who will play first? This time Matroskin came up with a brilliant solution, suggesting the most fair way to find it out: play rock-paper-scissors together. The rules of the game are very simple. On the count of three every player shows a combination with his hand (or paw). The combination corresponds to one of three things: a rock, scissors or paper. Some of the gestures win over some other ones according to well-known rules: the rock breaks the scissors, the scissors cut the paper, and the paper gets wrapped over the stone. Usually there are two players. Yet there are three friends, that’s why they decided to choose the winner like that: If someone shows the gesture that wins over the other two players, then that player wins. Otherwise, another game round is required. Write a program that will determine the winner by the gestures they have shown.
Uncle Fyodor、猫 Matroskin 和狗 Sharic 在普罗斯托克瓦希诺过着简单而幸福的生活。有时他们会收到 Uncle Fyodor 父母寄来的包裹,有时则会收到匿名捐赠者寄来的包裹;在后一种情况下,很难判断包裹究竟是寄给谁的。照相机步枪显然是给酷爱狩猎的 Sharic 的,鱼则是给 Matroskin 的,但那台崭新的视频游戏机又是给谁的呢?三位朋友都坚称这份礼物是给自己的,差点为此争吵起来。Uncle Fyodor 想出了一个公平的解决办法:假定这台游戏机是寄给三个人的,大家轮流玩。所有人都松了一口气,但紧接着又出现了一个棘手的问题——谁先玩?这次 Matroskin 提出了一个绝妙的解决方案,建议采用最公平的方式来决定:三人一起玩“石头剪刀布”。游戏规则非常简单:数到三时,每位玩家用手(或爪子)比出一种手势,该手势代表以下三种事物之一:石头、剪刀或布。根据众所周知的规则,某些手势能战胜另一些手势:石头砸坏剪刀,剪刀剪破布,布包住石头。通常该游戏只有两名玩家,但如今有三位朋友,因此他们约定如下方式决定胜者:若某位玩家的手势能同时战胜其余两位玩家的手势,则该玩家获胜;否则需进行下一轮游戏。请编写一个程序,根据三人所出示的手势判断胜者。
输入格式
The first input line contains the name of the gesture that Uncle Fyodor showed, the second line shows which gesture Matroskin showed and the third line shows Sharic’s gesture.
第一行输入为费多尔叔叔所出的手势名称,第二行为马特罗什金所出的手势,第三行为夏里克所出的手势。
输出格式
Print "F" (without quotes) if Uncle Fyodor wins. Print "M" if Matroskin wins and "S" if Sharic wins. If it is impossible to find the winner, print "?".
如果叔叔费奥多尔获胜,则输出 "F"(不带引号);如果马特罗什金获胜,则输出 "M";如果沙里克获胜,则输出 "S"。如果无法确定获胜者,则输出 "?"。
输入输出样例
输入#1
rock rock rock
输出#1
?
输入#2
paper rock rock
输出#2
F
输入#3
scissors rock rock
输出#3
?
输入#4
scissors paper rock
输出#4
?
输入解题思路,AI测评打分。不知道怎么写?