日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Kattis - bela

發布時間:2025/7/25 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。