Files
PAT/html/b1018.html
T

39 lines
1.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<h1>1018. 锤子剪刀布 (20)</h1>
<div id="problemContent">
<p>
大家应该都会玩“锤子剪刀布”的游戏:两人同时给出手势,胜负规则如图所示:</p>
<center><img src="http://nos.patest.cn/7r_muvaqb4myb9.jpg"/></center>
<p>
现给出两人的交锋记录,请统计双方的胜、平、负次数,并且给出双方分别出什么手势的胜算最大。
</p>
<p><b>
输入格式:
</b></p>
<p>输入第1行给出正整数N(&lt;=10<sup>5</sup>),即双方交锋的次数。随后N行,每行给出一次交锋的信息,即甲、乙双方同时给出的的手势。C代表“锤子”、J代表“剪刀”、B代表“布”,第1个字母代表甲方,第2个代表乙方,中间有1个空格。
</p>
<p><b>
输出格式:
</b></p>
<p>输出第1、2行分别给出甲、乙的胜、平、负次数,数字间以1个空格分隔。第3行给出两个字母,分别代表甲、乙获胜次数最多的手势,中间有1个空格。如果解不唯一,则输出按字母序最小的解。
</p>
<b>输入样例:</b><pre>
10
C J
J B
C B
B B
B C
C C
C B
J B
B C
J J
</pre>
<b>输出样例:</b><pre>
5 3 2
2 3 5
B B
</pre>
</div>