Kattis - bela
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 |
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 (S, H, D, C) 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 (A, K, Q, J, T, 9, 8, 7), and the second is the suit (S, H, D, C)).
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 |
60 |
| Sample Input 2 | Sample Output 2 |
|---|---|
4 H |
题意
给出一个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的更多相关文章
- It's a Mod, Mod, Mod, Mod World Kattis - itsamodmodmodmodworld (等差数列求和取模)
题目链接: D - It's a Mod, Mod, Mod, Mod World Kattis - itsamodmodmodmodworld 具体的每个参数的代表什么直接看题面就好了. AC代码: ...
- A - Piece of Cake Kattis - pieceofcake (数学)
题目链接: A - Piece of Cake Kattis - pieceofcake 题目大意:给你一个多边形,然后给你这个多边形的每个点的坐标,让你从这个n个点中选出k个点,问这个k个点形成的面 ...
- Subsequences in Substrings Kattis - subsequencesinsubstrings (暴力)
题目链接: Subsequences in Substrings Kattis - subsequencesinsubstrings 题目大意:给你字符串s和t.然后让你在s的所有连续子串中,找出这些 ...
- G - Intersecting Rectangles Kattis - intersectingrectangles (扫描线)(判断多个矩形相交)
题目链接: G - Intersecting Rectangles Kattis - intersectingrectangles 题目大意:给你n个矩形,每一个矩形给你这个矩形的左下角的坐标和右上角 ...
- E - Emptying the Baltic Kattis - emptyingbaltic (dijkstra堆优化)
题目链接: E - Emptying the Baltic Kattis - emptyingbaltic 题目大意:n*m的地图, 每个格子有一个海拔高度, 当海拔<0的时候有水. 现在在(x ...
- G - Galactic Collegiate Programming Contest Kattis - gcpc (set使用)
题目链接: G - Galactic Collegiate Programming Contest Kattis - gcpc 题目大意:当前有n个人,一共有m次提交记录,每一次的提交包括两个数,st ...
- Kattis - virus【字符串】
Kattis - virus[字符串] 题意 有一个正常的DNA序列,然后被病毒破坏.病毒可以植入一段DNA序列,这段插入DNA序列是可以删除正常DNA序列中的一个连续片段的. 简单来说就是,给你一段 ...
- Kattis - bank 【简单DP】
Kattis - bank [简单DP] Description Oliver is a manager of a bank near KTH and wants to close soon. The ...
- City Destruction Kattis - city dp
/** 题目:City Destruction Kattis - city 链接:https://vjudge.net/problem/Kattis-city 题意:有n个怪兽,排成一行.每个怪兽有一 ...
随机推荐
- 插入排序InsertSort
插入排序:从第二个数开始 一直和前面的数组比较 获得排序定位 代码 /** *插入排序 */ public class InsertSort { public static void inser ...
- Period UVA - 1328_结论题
Code: #include<cstdio> #include<cstring> using namespace std; const int maxn=1000000+5; ...
- jQuery节点操作方法大全
1.append() 向每个匹配的元素内部追加内容 HTML代码: <p>我想说:</p> jQuery代码: $('p').append('<b>你好</b ...
- IOS - NSDate 自己挖的坑,自己跳
NSDate:5是坑啊啊! NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDat ...
- SpProcPool阅读笔记--1
公司产品用了一个开源的框架,最近出了点问题,细看了这个框架. SpProcPool: https://github.com/spsoft/spprocpool.git 我们的线程池用的是传递文件描述 ...
- Linux进程间通信--进程,信号,管道,消息队列,信号量,共享内存
Linux进程间通信--进程,信号,管道,消息队列,信号量,共享内存 参考:<linux编程从入门到精通>,<Linux C程序设计大全>,<unix环境高级编程> ...
- BA--干球温度、露点温度和湿球温度--概念
1. 干球温度.露点温度和湿球温度 dry bulb temperature, dew temperature, and wet-bulb temperature 摘要:未饱和湿空气中水蒸汽处于过热状 ...
- git-osc自己定义控件之:CircleImageView
git-osc自己定义控件之:CircleImageView 一.CircleImageView的使用 在项目中能够发现,用户的头像都是圆形的.感觉非常好奇,昨天最终发现了,原来是自定了一个Image ...
- Flash的选择
算起来自己接触Flash接近4年了. 最開始的2.0,做button,做动画,做导航. 后来用3.0做动画,做相冊.做毕业设计,做课件. 然后到公司做2.0的动画,模板开发,效果设计. 似乎又回到了原 ...
- [Tailwind] Get started with Tailwindcss
In this lesson, we learn how to generate CSS utility classes from Tailwind's JavaScript config file. ...