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

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;
        } else
            sum += aa[b1].a2;
    }
    cout << sum << endl;
    return 0;
}
时间: 2024-10-13 06:07:56

Kattis - bela的相关文章

Kattis - Association for Computing Machinery

Association for Computing Machinery ACM (Association for Computing Machinery) organizes the International Collegiate Programming Contest (ICPC) worldwide every year. In the ICPC, a team of three students is presented with a problem set that contains 

Kattis downtime

链接:https://open.kattis.com/problems/downtime 题意:n个要解决的进程,每个服务器可以解决k个进程,每个进程花费1000MS,给出n个进程的开始时间,问最少要几个服务器 思路:我们可以求出每个进程的区间,然后看我们可以不重叠的解决多少个进程 1 #include<bits/stdc++.h> 2 using namespace std; 3 4 struct node{ 5 int x; 6 int y; 7 }a[200005]; 8 bool cm

City Destruction Kattis - city dp

/** 题目:City Destruction Kattis - city 链接:https://vjudge.net/problem/Kattis-city 题意:有n个怪兽,排成一行.每个怪兽有一个生命值和一个爆炸值.每次可以选择一个怪兽攻击早造成d伤害. 如果生命值<=0:那么怪兽i死亡并且爆炸.i+1,i-1第怪兽都会受到 第i个怪兽的爆炸值伤害.如果第i-1被第i炸死,第i-1怪兽不会继续炸别人. 不会传递.也就是只有攻击者攻击致死的怪兽才会对i-1,i+1造成爆炸值伤害. 求最少攻击

Installing Apps Kattis - installingapps (贪心 + 背包)

Installing Apps Kattis - installingapps Sandra recently bought her first smart phone. One of her friends suggested a long list of applications (more commonly known as “apps”) that she should install on the phone. Sandra immediately started installing

Subsequences in Substrings Kattis - subsequencesinsubstrings (暴力)

题目链接: Subsequences in Substrings Kattis - subsequencesinsubstrings 题目大意:给你字符串s和t.然后让你在s的所有连续子串中,找出这些连续子串中的非连续子串中包含t的有多少个. 具体思路:我们枚举s的每一个位置,然后判断一下s的包含t的非连续子串中到达那个位置,然后这个字符串两边的长度相乘就是当前位置开始,满足条件的字符位置.然后我们在找从上一次找到首字母位置下一个开始, 继续往下找就可以了. AC代码: 1 #include<b

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

题目链接: A - Piece of Cake Kattis - pieceofcake 题目大意:给你一个多边形,然后给你这个多边形的每个点的坐标,让你从这个n个点中选出k个点,问这个k个点形成的面积的期望. 具体思路:我们肯定不能硬跑每一个k边形,肯定会超时.我们以每个点作为起点,从这个点开始,形成的面积的期望是多少,然后遍历每一个点,这样算出来的会有重复,最后除以2就可以了. 然后算面积的时候,我们分开算.一个多边形的面积等于每个点按照顺时针或者是逆时针两个点之间的叉积. 求组合数的时候,

Kattis - hoppers Hoppers(判奇环)

题目传送门:Kattis - hoppers  Hoppers 题目大意: 你是一个黑客,现在你发明了一种感染病毒,这种感染病毒能够感染到与该主机相隔一个点的主机. 存在一个无向图,每个点代表一台主机,每条无向边表示两台主机相连,现在你有个计划是通过感 染一个电脑让所有电脑感染,你可以为两条电脑之间加边,需要你求出最少加多少条边能够完成计划 分析: 我们能够发现奇数环中任何一个点被感染都能够使奇数环中所有的点感染.因此我们可以利用该性质. 为了满足条件(感染一个点使所有点被感染)存在几种情况:

G - Non-Prime Factors Kattis - nonprimefactors (筛1-n内的当前数中非素数的个数)

题目链接: G - Non-Prime Factors  Kattis - nonprimefactors 题目大意:给你一个数n,然后问你n的因子中非素数的个数. 具体思路:埃筛,把每一个数的因子直接算出来就好了. AC代码: 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int maxn = 2e6 + 100; 4 int vis[maxn]; 5 int sto[maxn]; 6 void init() 7 { 8 f

kattis Curious Cupid (莫队算法)

Curious Cupid There are K different languages in the world. Each person speaks one and only one language. There are exactly N single men and N single women. Cupid, the god of love, wants to match every single man to a single woman, and vice versa. Ev