CF104A.Blackjack

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

One rainy gloomy evening when all modules hid in the nearby cafes to drink hot energetic cocktails, the Hexadecimal virus decided to fly over the Mainframe to look for a Great Idea. And she has found one!

Why not make her own Codeforces, with blackjack and other really cool stuff? Many people will surely be willing to visit this splendid shrine of high culture.

In Mainframe a standard pack of 52 cards is used to play blackjack. The pack contains cards of 13 values: 2, 3, 4, 5, 6, 7, 8, 9, 10, jacks, queens, kings and aces. Each value also exists in one of four suits: hearts, diamonds, clubs and spades. Also, each card earns some value in points assigned to it: cards with value from two to ten earn from 2 to 10 points, correspondingly. An ace can either earn 1 or 11, whatever the player wishes. The picture cards (king, queen and jack) earn 10 points. The number of points a card earns does not depend on the suit. The rules of the game are very simple. The player gets two cards, if the sum of points of those cards equals n, then the player wins, otherwise the player loses.

The player has already got the first card, it's the queen of spades. To evaluate chances for victory, you should determine how many ways there are to get the second card so that the sum of points exactly equals n.

一个阴雨绵绵的昏暗傍晚,当所有模块都躲进附近的咖啡馆喝热腾腾的能量鸡尾酒时,十六进制病毒决定飞越主控机(Mainframe),寻找一个“绝妙创意”。而她真的找到了!

何不自己创建一个 Codeforces 呢?加入二十一点(blackjack)以及其他真正酷炫的元素!想必会有很多人乐于造访这座高雅文化的宏伟圣殿。

在主控机中,玩二十一点使用的是标准的 52 张牌组。该牌组包含 13 种点数的牌:2、3、4、5、6、7、8、9、10、J(杰克)、Q(皇后)、K(国王)和 A(王牌)。每种点数又分别属于四种花色之一:红桃(hearts)、方块(diamonds)、梅花(clubs)和黑桃(spades)。此外,每张牌还对应一定的分数:点数为 2 至 10 的牌分别对应 2 至 10 分;A(王牌)可计为 1 分或 11 分,由玩家自行选择;图片牌(即 K、Q、J)均计为 10 分。一张牌的分数与其花色无关。

游戏规则极为简单:玩家初始获得两张牌;若这两张牌的分数之和恰好等于 $ n $,则玩家获胜;否则玩家失败。

目前玩家已获得第一张牌——黑桃 Q(queen of spades)。为了评估获胜概率,你需要计算:有多少种可能的第二张牌,能使两张牌的分数之和恰好等于 $ n $?

输入格式

The only line contains n (1 ≤ n ≤ 25) — the required sum of points.

唯一的一行包含 $ n (( 1 \leq n \leq 25 $)——所需的点数之和。

输出格式

Print the numbers of ways to get the second card in the required way if the first card is the queen of spades.

如果第一张牌是黑桃Q,输出以要求的方式拿到第二张牌的方法数。

输入输出样例

  • 输入#1

    12

    输出#1

    4
  • 输入#2

    20

    输出#2

    15
  • 输入#3

    10

    输出#3

    0

说明/提示

In the first sample only four two's of different suits can earn the required sum of points.

In the second sample we can use all tens, jacks, queens and kings; overall it's 15 cards, as the queen of spades (as any other card) is only present once in the pack of cards and it's already in use.

In the third sample there is no card, that would add a zero to the current ten points.

在第一个样例中,只有四张不同花色的 2 能凑出所需的总分数。

在第二个样例中,我们可以使用所有的 10、J、Q 和 K;总共是 15 张牌,因为黑桃 Q(如同其他任意一张牌)在一副牌中仅出现一次,且已被使用。

在第三个样例中,没有任何一张牌能在当前 10 分的基础上加 0 分。

输入解题思路,AI测评打分。不知道怎么写?

首页