Bela

Young Mirko is a smart, but mischievous boy who often wanders around parks looking for new ideas. This time he’s come across pensioners playing the card game Belote. They’ve invited him to help them determine the total number of points in a game.

Each card can be uniquely determined by its number and suit. A set of four cards is called a hand. At the beginning of a game one suit that “trumps” any other is chosen, and it is called the dominant suit. The number of points in a game is equal to the sum of values of each card from each hand in the game. Mirko has noticed that the pensioners have played NN hands and that suit BB was the dominant suit.

The value of each card depends on its number and whether its suit is dominant, and is given in Table 1.

Number

Value

 

Dominant

Not dominant

A

1111

1111

K

44

44

Q

33

33

J

2020

22

T

1010

1010

9

1414

00

8

00

00

7

00

00

Table 1: Scores

Write a programme that will determine and output the number of points in the game.

Input

The first line contains the number of hands NN (1≤N≤1001≤N≤100) and the value of suit BB (SHDC) from the task. Each of the following 4N4N lines contains the description of a card (the first character is the number of the ii-th card (AKQJT987), and the second is the suit (SHDC)).

Output

The first and only line of output must contain the number of points from the task.

Sample Input 1 Sample Output 1
2 S
TH
9C
KS
QS
JS
TD
AD
JH
60
 Sample Input 2  Sample Output 2
4 H
AH
KH
QH
JH
TH
9H
8H
7H
AS
KS
QS
JS
TS
9S
8S
7S
 

题意

给出一个n和一个b,b是钻石牌,然后给4*n的卡牌,计算总积分,如果有b的话则加上面对应的表的第一个数,否则加第二个数

代码

#include<bits/stdc++.h>
using namespace std;
struct Node {
int a1;
int a2;
} aa[]; int main() {
int n;
char b;
cin >> n >> b;
int sum = ;
aa[].a1 = ;
aa[].a2 = ;
aa[].a1 = ;
aa[].a2 = ;
aa[].a1 = ;
aa[].a2 = ;
aa[].a1 = ;
aa[].a2 = ;
aa[].a1 = ;
aa[].a2 = ;
aa[].a1 = ;
aa[].a2 = ;
aa[].a1 = ;
aa[].a2 = ;
aa[].a1 = ;
aa[].a2 = ;
for(int i = ; i < * n; i++) {
char b1, b2;
cin >> b1 >> b2;
if(b2 == b) {
sum += aa[b1].a1;
} else
sum += aa[b1].a2;
}
cout << sum << endl;
return ;
}

Kattis - bela的更多相关文章

  1. It's a Mod, Mod, Mod, Mod World Kattis - itsamodmodmodmodworld (等差数列求和取模)

    题目链接: D - It's a Mod, Mod, Mod, Mod World Kattis - itsamodmodmodmodworld 具体的每个参数的代表什么直接看题面就好了. AC代码: ...

  2. A - Piece of Cake Kattis - pieceofcake (数学)

    题目链接: A - Piece of Cake Kattis - pieceofcake 题目大意:给你一个多边形,然后给你这个多边形的每个点的坐标,让你从这个n个点中选出k个点,问这个k个点形成的面 ...

  3. Subsequences in Substrings Kattis - subsequencesinsubstrings (暴力)

    题目链接: Subsequences in Substrings Kattis - subsequencesinsubstrings 题目大意:给你字符串s和t.然后让你在s的所有连续子串中,找出这些 ...

  4. G - Intersecting Rectangles Kattis - intersectingrectangles (扫描线)(判断多个矩形相交)

    题目链接: G - Intersecting Rectangles Kattis - intersectingrectangles 题目大意:给你n个矩形,每一个矩形给你这个矩形的左下角的坐标和右上角 ...

  5. E - Emptying the Baltic Kattis - emptyingbaltic (dijkstra堆优化)

    题目链接: E - Emptying the Baltic Kattis - emptyingbaltic 题目大意:n*m的地图, 每个格子有一个海拔高度, 当海拔<0的时候有水. 现在在(x ...

  6. G - Galactic Collegiate Programming Contest Kattis - gcpc (set使用)

    题目链接: G - Galactic Collegiate Programming Contest Kattis - gcpc 题目大意:当前有n个人,一共有m次提交记录,每一次的提交包括两个数,st ...

  7. Kattis - virus【字符串】

    Kattis - virus[字符串] 题意 有一个正常的DNA序列,然后被病毒破坏.病毒可以植入一段DNA序列,这段插入DNA序列是可以删除正常DNA序列中的一个连续片段的. 简单来说就是,给你一段 ...

  8. Kattis - bank 【简单DP】

    Kattis - bank [简单DP] Description Oliver is a manager of a bank near KTH and wants to close soon. The ...

  9. City Destruction Kattis - city dp

    /** 题目:City Destruction Kattis - city 链接:https://vjudge.net/problem/Kattis-city 题意:有n个怪兽,排成一行.每个怪兽有一 ...

随机推荐

  1. Project Euler 21 Distinct primes factors( 整数因子和 )

    题意: 记d(n)为n的所有真因数(小于n且整除n的正整数)之和. 如果d(a) = b且d(b) = a,且a ≠ b,那么a和b构成一个亲和数对,a和b被称为亲和数. 例如,220的真因数包括1. ...

  2. nyoj28-大数阶乘

    大数阶乘 时间限制:3000 ms  |  内存限制:65535 KB 难度:3 描述 我们都知道如何计算一个数的阶乘,可是,如果这个数很大呢,我们该如何去计算它并输出它? 输入 输入一个整数m(0& ...

  3. maven构建本地jar包到本地仓库

    maven命令: mvn:install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=1.0 -Dpackaging ...

  4. Python学习笔记(1)Pycharm基本认识

    Pycharm的使用 集成开发环境(IDE,集成开发环境) VIM  #经典的linux下的文本编辑器 Pycharm,主要用于python开发的ide PyCharm常用快捷键 Ctrl + / # ...

  5. Tensorflow读取文件到队列文件

    TensorFlow读取二进制文件数据到队列 2016-11-03 09:30:00      0个评论    来源:diligent_321的博客   收藏   我要投稿 TensorFlow是一种 ...

  6. JavaScript(正则表达式一)

    -------------------- 创建正则表达式: 验证匹配的两个方法 //正则表达式测试 /* var p=new RegExp("Box","i") ...

  7. Exchange EMC打开出错 解决

    Exchange控制台打开出错如何解决 1.卸载win server功能中的winrm iis 2.重启 3.安装winrm iis 4.查看default web site 有没有绑定80端口,没有 ...

  8. BA-Bacnet ip 、TCP/IP

    BACENT IP TCP/IP协议

  9. BA-Delta知识点

    问题: DSM-RTR的网络负载能力是怎样的?每条总线带32个模块吗?MS/TP总线上的模块需要拨地址码吗?最大可以承载多少个点? 答:理论值是30,最佳性能是21个,一般情况25-28个 linkn ...

  10. N - 畅通工程再续

    N - 畅通工程再续 思路:zz #include<cmath> #include<cstdio> #include<cstring> #include<io ...