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

建议使用的浏览器:

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

6931:Halli Galli

题目描述


Now there are $K$ people play Halli Galli game.They will play $N$ turns in all,in the order of the first player,the second player,$\cdots$,the $K$ player,the first player,$\cdots$.

In one turn,the player will display a card on his side,if there are $a$ kinds of fruit which its total ammount is exactly 5 in all sides,the bell will be pushed $a$ times in this turn.Notices that the previous card will be covered by the current card.

Now you have to calculate the total times they push the bell in $N$ turns.
输入解释
There are $T(1 \leq T \leq 100)$ test cases in this problem.

For every test cases,the first line has two integers $N(1 \leq N \leq 100)$, $K(1 \leq K \leq 6)$respectively representing the number of turns, the number of people.

The next $N$ rows with a char $ch$ and an integer $x(1 \leq x \leq 5)$,respectively representing the type of fruit on the card,the ammount of fruit on the card.

There are always four kinds of fruit,respectively $A$,$B$,$G$,$P$(Apple,Banana,Grape,Pear).
输出解释
For every test case, output the answer in a line.
输入样例
1
5 3
A 5
B 2
B 3
G 1
P 5
输出样例
6
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6931

最后修改于 2021-06-22T18:18:57+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 262144/262144K(Java/Others)