QOJ.ac

QOJ

时间限制: 1 s 内存限制: 64 MB 总分: 50

#13780. BELA

统计

年轻的 Mirko 是一个聪明但调皮的男孩,他经常在公园里闲逛寻找新的灵感。这一次,他遇到了正在玩纸牌游戏 Belote 的退休老人。他们邀请他帮忙计算在一局游戏中赢得的总分数。

每张纸牌都可以由其点数和花色唯一确定。一组四张牌被称为一轮(hand)。在每局游戏中,有一种花色可以“压制”其他所有花色,被称为主牌花色(dominant suit)。一局游戏中的总得分等于赢得的每轮牌中每张纸牌的分值之和。Mirko 注意到老人们赢得了 $N$ 轮牌,且花色 $B$ 是主牌花色。

纸牌的分值如下表所示:

纸牌点数 主牌花色分值 非主牌花色分值
A 11 11
K 4 4
Q 3 3
J 20 2
T 10 10
9 14 0
8 0 0
7 0 0

编写一个程序,计算并输出游戏中赢得的总分数。

输入格式

第一行包含轮数 $N$($1 \le N \le 100$)和主牌花色 $B$(SHDC 之一)。

接下来的 $4N$ 行,每行包含一张纸牌 $K_i$ 的描述(第一个字符为第 $i$ 张牌的点数(AKQJT987),第二个字符为第 $i$ 张牌的花色(SHDC))。

输出格式

输出的第一行也是唯一一行,必须包含计算出的总分数。

样例

输入样例 1

2 S
TH
9C
KS
QS
JS
TD
AD
JH

输出样例 1

60

输入样例 2

4 H
AH
KH
QH
JH
TH
9H
8H
7H
AS
KS
QS
JS
TS
9S
8S
7S

输出样例 2

92

说明

第二个样例的解释:总分数为 $11 + 4 + 3 + 20 + 10 + 14 + 0 + 0 + 11 + 4 + 3 + 2 + 10 + 0 + 0 + 0 = 92$ 分。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.