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[200];int main() {int n;char b;cin >> n >> b;int sum = 0;aa[65].a1 = 11;aa[65].a2 = 11;aa[75].a1 = 4;aa[75].a2 = 4;aa[81].a1 = 3;aa[81].a2 = 3;aa[74].a1 = 20;aa[74].a2 = 2;aa[84].a1 = 10;aa[84].a2 = 10;aa[57].a1 = 14;aa[57].a2 = 0;aa[56].a1 = 0;aa[56].a2 = 0;aa[55].a1 = 0;aa[55].a2 = 0;for(int i = 0; i < 4 * n; i++) {char b1, b2;cin >> b1 >> b2;if(b2 == b) {sum += aa[b1].a1;} elsesum += aa[b1].a2;}cout << sum << endl;return 0;
}

转载于:https://www.cnblogs.com/zhien-aa/p/6279553.html

Kattis - bela相关推荐

  1. Kattis - icpccamp ICPC Camp(二分+贪心)

    题目链接:点击查看 题目大意:给出两种种类的数字分别 m1m_1m1​ 和 m2m_2m2​ 个,现在要求匹配 nnn 个不同种类的数字,每个数字只能使用一次,且两数之和不能超过 sss,输出任意两对 ...

  2. Kattis Problem-Unique Snowflakes

    Kattis Problem-Unique Snowflakes 原题链接 题目类型:双指针 题意 给定一个整数序列,找出最长的不重复子串的长度. 分析 使用双指针,枚举每个指针 I,然后每次判断指针 ...

  3. 关于优先队列在图中的应用G - Millionaire Madness Kattis - millionairemadness

    G - Millionaire Madness Kattis - millionairemadness 文章大意:就是给你一个n*m的图(int)代表货物的高度),可以上下左右移动一次一格,但是去高度 ...

  4. Kattis之旅——Prime Reduction

    A prime number p≥2 is an integer which is evenly divisible by only two integers: 1 and p. A composit ...

  5. 水题Kattis Temperature Confusion小学数学

    题目 Sample Input 1 Sample Output 132/10/1Sample Input 2 Sample Output 233/15/9Sample Input 3 Sample O ...

  6. kattis ones简单题取模运算+枚举

    题目链接原链接 题目 给定不被2和5整除的整数n,有些n的倍数是十进制中的1的序列(比如111,1111111).其中最小的一个1的序列是几位数字? 比如数字3的37倍是111.所以是三位 Given ...

  7. 【Kattis - triangle 】Sierpiński Circumference(数学,求位数,取对数或Java)

    题干: Polish mathematician Wacław Sierpiński (1882-1969) described the 2D geometric figure known as th ...

  8. Zoning Houses Kattis 多组记录线段树/ST表

    1.题意:给你n个平面上的点,再给你m个询问,每个询问包括[ l, r ]内的点,让你求出包含这些点在内的最小正方形的边长,你可以忽略这些点内的一个点. 2.分析:如果不忽略点,我们只需要取这些点中的 ...

  9. D - Dragon Balls Kattis - dragonballs

    题目链接 题意:交互题,就是提问系统不超过1000次然后找到n颗龙珠,但龙珠是1颗1颗找到的并不是1次全部找到,这样就很简单了,每次循环输出1个(0,0),然后找到与远点相聚为d的所有的点,然后在分别 ...

最新文章

  1. Spark任务提交源码
  2. 欢迎参与 KubeVela 官方文档翻译活动
  3. Jenkins集成java非maven/ant项目的打包思路
  4. Spring 加载、解析applicationContext.xml 流程
  5. Six Basic Functional Areas of Spring
  6. linux0.11学习笔记-技术铺垫-简单AB任务切换程序(1)-实现一个简单的bootloader
  7. 复数幂用java程序怎么求_蓝桥杯——复数幂 (2018JavaAB组第3题)
  8. Office365 PowerShell打开邮箱审计功能
  9. MSCHART控件中长字符的X轴坐标标注全部显示
  10. matlab中firrcos,DMR数字集群关键技术的应用研究
  11. drools-基本使用
  12. Java2048游戏源代码
  13. 三年级计算机课标,三年级信息技术教案上册
  14. 知识图谱数据管理:存储与检索
  15. 微信:签名不对,请检查签名是否与开放平台上填写的一致
  16. MPLAB X IDE开发环境
  17. YZ-9846时间同步装置 “四统一、四规范”,确保各时间同步设备时间高精度统一
  18. 编译原理8:递归下降分析器、扩充巴斯克范式、JavaCC
  19. 宝峰uv5r保存信道频率_【对讲机的那点事】宝峰UV-5R对讲机上中继台的信道存储设置方法...
  20. Dweb:使用WebRTC / WebTorrent构建弹性Web

热门文章

  1. Sublime Text 2 安装配置插件
  2. ARX中的Purge
  3. 快速获取OpenCV库(Lib)文件下的所有文件的目录名~
  4. 利用OpenCV的库函数Sobel和Scharr作图像的边缘检测
  5. 用OpenCV实现图像的水平镜像(翻转)变换和竖直镜像(翻转)变换(垂直镜像变换)的源码
  6. 在DataGridView控件中加入ComboBox下拉列表框的实现
  7. pyqt5 输入确认_对PyQt5的输入对话框使用(QInputDialog)详解
  8. 现代软件工程 作业 团队冲刺阶段的要求
  9. Spring Boot实践--CommandLineRunner接口
  10. AJAX 在Django 设置csrf_token