欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

Kattis - bela

发布时间:2025/7/25 47 豆豆
生活随笔 收集整理的这篇文章主要介绍了 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 (1N1001≤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 1Sample 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的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。