A8217 | Blackjack
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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$ .
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$ .
输入格式
The only line contains $n$ ( $1<=n<=25$ ) — the required sum of points.
输出格式
Print the numbers of ways to get the second card in the required way if the first card is the queen of spades.
输入输出样例
输入 #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.
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted