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
  1. 2 S
  2. TH
  3. 9C
  4. KS
  5. QS
  6. JS
  7. TD
  8. AD
  9. JH
  1. 60
 Sample Input 2  Sample Output 2
  1. 4 H
  2. AH
  3. KH
  4. QH
  5. JH
  6. TH
  7. 9H
  8. 8H
  9. 7H
  10. AS
  11. KS
  12. QS
  13. JS
  14. TS
  15. 9S
  16. 8S
  17. 7S
 

题意

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

代码

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. struct Node {
  4. int a1;
  5. int a2;
  6. } aa[];
  7.  
  8. int main() {
  9. int n;
  10. char b;
  11. cin >> n >> b;
  12. int sum = ;
  13. aa[].a1 = ;
  14. aa[].a2 = ;
  15. aa[].a1 = ;
  16. aa[].a2 = ;
  17. aa[].a1 = ;
  18. aa[].a2 = ;
  19. aa[].a1 = ;
  20. aa[].a2 = ;
  21. aa[].a1 = ;
  22. aa[].a2 = ;
  23. aa[].a1 = ;
  24. aa[].a2 = ;
  25. aa[].a1 = ;
  26. aa[].a2 = ;
  27. aa[].a1 = ;
  28. aa[].a2 = ;
  29. for(int i = ; i < * n; i++) {
  30. char b1, b2;
  31. cin >> b1 >> b2;
  32. if(b2 == b) {
  33. sum += aa[b1].a1;
  34. } else
  35. sum += aa[b1].a2;
  36. }
  37. cout << sum << endl;
  38. return ;
  39. }

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. centos7部署openvasV9

    应特别注意,openvas更新很快,本文章仅描述了当前版本和特定环境的部署.基础环境描述如下.环境相关版本并不要求完全相同.默认阅读者有一定的Linux基础,不做赘述.本机环境: [root@linu ...

  2. python中的全局变量、局部变量、实例变量

    1.全局变量:在模块内,在所有函数.类外面. 2.局部变量:在函数内,在类方法内(未加self修饰的) 3.静态变量:在类内,但不在类方法内.[共同类所有,值改变后,之后所有的实例对象也改变] 4.实 ...

  3. Python可视化数据------seaborn

    可以看链接:https://blog.csdn.net/unixtch/article/details/78820654 1.import seaborn as sns 2.seaborn的主题风格( ...

  4. 【LeetCode算法】LeetCode初级算法——字符串

      在LeetCode初级算法的字符串专题中,共给出了九道题目,分别为:反转字符串,整数反转,字符串中的第一个唯一字符,有效的字母异位词,验证回文字符串,字符串转换整数,实现strStr(),报数,最 ...

  5. Node-Blog整套前后端学习记录

    Node-Blog 后端使用node写的一个一整套的博客系统 #### 主要功能 登录 注册 发表文章 编辑/删除文章 添加/删除/编辑文章分类 账号的管理 评论功能 ... 所用技术 node ex ...

  6. JAVAEE网上商城项目总结

    发送邮件实现(使用QQ邮箱发送到指定邮箱) 需要的jar 邮件发送类代码: package util; import java.util.Properties; import javax.mail.A ...

  7. 【剑指Offer学习】【面试题63:二叉搜索树的第k个结点】

    题目:给定一棵二叉搜索树,请找出当中的第k大的结点. 解题思路 假设依照中序遍历的顺序遍历一棵二叉搜索树,遍历序列的数值是递增排序的. 仅仅须要用中序遍历算法遍历一棵二叉搜索树.就非常easy找出它的 ...

  8. POJ 3050 Hopscotch 水~

    http://poj.org/problem?id=3050 题目大意: 在一个5*5的格子中走,每一个格子有个数值,每次能够往上下左右走一格,问走了5次后得到的6个数的序列一共同拥有多少种?(一開始 ...

  9. NYOJ_94 cigarettes 递归VS迭代

    题目地址 分析: 英文题事实上看懂意思和正常的也都差点儿相同.就算有几个单词不认识也无伤大雅. 一共同拥有n支烟,每天抽k支. 每抽完k支,会得到一仅仅. a组数据.  输入n k的个数.输出一共抽了 ...

  10. XML系统学习

    参考:W3School XML基本概念 1.XML是eXtensible Markup Language,使用DTD(Document Type Definition)来描述数据,主要是为传输和存储数 ...