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. spring cloud(一) 副 consul

    spring cloud 使用consul作为注册中心 1.安装consul 使用docker安装 查找consul镜像 docker search consul 下载镜像 docker pull c ...

  2. 何为JQuery对象?

  3. 容器化haproxy+keepalived

    # 拉取haproxy镜像 docker pull haproxy:1.7.8-alpine mkdir /etc/haproxy cat >/etc/haproxy/haproxy.cfg&l ...

  4. Project Euler 48 Self powers( 大数求余 )

    题意: 项的自幂级数求和为 11 + 22 + 33 + - + 1010 = 10405071317. 求如下一千项的自幂级数求和的最后10位数字:11 + 22 + 33 + - + 100010 ...

  5. 记录python爬取猫眼票房排行榜(带stonefont字体网页),保存到text文件,csv文件和MongoDB数据库中

    猫眼票房排行榜页面显示如下: 注意右边的票房数据显示,爬下来的数据是这样显示的: 网页源代码中是这样显示的: 这是因为网页中使用了某种字体的缘故,分析源代码可知: 亲测可行: 代码中获取的是国内票房榜 ...

  6. Nginx的反向代理的配置

    1.linux下的方向代理(前提域名和P已经映射好了的) 在linux中的输入命令:whereis nginx 查看当前nginx的安装目录 显示 nginx: /usr/local/nginx 命令 ...

  7. VLC编译

    http://blog.csdn.net/hdh4638/article/details/7602321 1 下载代码 ki.videolan.org/VLC_Source_code git colo ...

  8. HDU5976 Detachment

    /* HDU5976 Detachment http://acm.hdu.edu.cn/showproblem.php?pid=5976 数论 等差数列 * * */ #include <cst ...

  9. [SharePoint2010开发入门经典]SPS2010开发工具

    本章概要: 1.了解不同的开发SPS的方法 2.了解SPS开发工具和环境 3.使用VS2010和SPD还有Blend开发SPS

  10. POJ 1284

    想了很久,只想到枚举的方法,估计会超时吧. 原来有这样一条性质:p为素数,则p有phi(p-1)个原根 Orz... #include <iostream> #include <cs ...