日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Kattis - bela

發(fā)布時間:2025/7/25 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Kattis - bela 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

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的話則加上面對應的表的第一個數(shù),否則加第二個數(shù)

代碼

#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; }

?

?

轉(zhuǎn)載于:https://www.cnblogs.com/zhien-aa/p/6279553.html

總結(jié)

以上是生活随笔為你收集整理的Kattis - bela的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。