cpp题目描述小 �C 喜欢玩纸牌游戏每次他都会和 ���czx 玩 2121 点这是一种很流行的纸牌游戏。这个游戏的规则是在纸牌点数之和小于 2121 点之前可以连续抓牌如果决定不抓牌则喊 �����DOSTA。游戏开始时桌面有 5252 张牌 —— 牌面分别是 23…JQKA23…JQKA每种有 44 个花色。它们的点数计算规则是:牌面上的数字就是点数比如99 的点数就是 99特殊地JQKJQ
#include
int main() {
int N;
cin >> N;
vector
int sum = 0;
for (int i = 0; i < N; i++) {
sum += cards[i];
}
int X = 21 - sum;
int greaterCount = 0;
int smallerCount = 0;
for (int i = 1; i <= 10; i++) {
if (i > X) {
greaterCount += 4;
} else if (i < X) {
smallerCount += 4;
}
}
if (greaterCount > smallerCount || greaterCount == smallerCount) {
cout << "DOSTA" << endl;
} else {
cout << "VUCI" << endl;
}
return 0;
原文地址: https://www.cveoy.top/t/topic/iLRk 著作权归作者所有。请勿转载和采集!