P4419 [COCI2017-2018#1] Cezar

该博客讲述了小凯撒在玩21点时遇到的困境,玩家根据手中的牌和剩余牌库的情况决定是否继续抽取牌。若牌库中数值大于当前和与21的差的牌数量大于等于数值小于等于此差的牌,则停止抽取,否则继续。博客提供输入输出样例并求解是否可以继续抽牌。
摘要由CSDN通过智能技术生成

题目描述

Little Caesar likes card games. Everytime he comes to Zagreb, he plays blackjack, the famous card game, with his friends.

In this game, the player draws cards while the sum of the cards in his hand is less than or equal to 21 or until he says “DOSTA” (Croatian for “STOP”).

At the beginning of the game, there are 52 cards in the deck, thirteen ranks of each of the four suits. The card ranks are two, three, …, ten, Jack, Queen, King and Ace. The card values are the following: the cards with numbers on them are worth that number (e.g., “nine” is 9), the cards with pictures (Jack, Queen, and King) are worth 10, whereas the Ace is worth 11.

Caesar has found himself in an interesting situation. During the game, he already drew N cards whose sum is less than or equal to 21 and is now having second thoughts about drawing one more card or not. Let’s assume X is the difference from the sum of the cards so far to 21. Everybody knows that you don’t draw a

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值