A. Blackjack

time limit per test

 2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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.

Input

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

Output

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

Examples

input

12

output

4

input

20

output

15

input

10

output

0

Note

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.

题意:一副扑克牌,一共52张,其中有2,3,4,5,6,7,8,9,10,J,Q,K,A。其中2~9的分值是相对应的数,A的分值可以是1或者11,然后10,J,Q,K的分值都是10.题目现在输入一个数,现在给你一张已经选好的牌Q,然后你从其中再选出一张其他的牌,使这两张牌的分值等于这个数。然后求出有几种不同的选取方式(注:每个数都是4中花色,分别是黑桃,梅花,红桃,方块)。题目意思很简单,就是分几种情况输出就行,不过要切记,判断大于21分的数值,他们都为0,我就是因为这个没判断,足足WA了8次(我真的是个大人才...)。

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm> using namespace std; int main()
{
int n;
while(~scanf("%d",&n)&&n)
{
n-=; //减10的原因是方便后面的计算
if(n<=||n>)
cout<<<<endl;
else if(n==)
cout<<<<endl;
else
cout<<<<endl;
}
return ;
}

A. Blackjack的更多相关文章

  1. Mini projects #6 ---- Blackjack

    课程全名:An Introduction to Interactive Programming in Python,来自 Rice University 授课教授:Joe Warren, Scott ...

  2. BlackJack Strategy

    GAME SPEC: 2-deck, 104 cards total. Bellagio has 2-deck and 6-deck games. based on hard 17, dealer h ...

  3. [CareerCup] 8.1 Implement Blackjack 实现21点纸牌

    8.1 Design the data structures for a generic deck of cards. Explain how you would subclass the data ...

  4. python面对对象编程----1:BlackJack(21点)

    昨天读完了<Mastering Object-oriented Python>的第一部分,做一些总结. 首先,第一部分总过八章,名字叫Pythonic Classes via Specia ...

  5. 逆向分析一款国外Blackjack Card Counter软件并附上License生成脚本

    没有学过逆向,一时兴起,搞了一下这个小软件,名为“逆向分析”,其实过程非常简单,难登大雅之堂,就当段子看吧.首先介绍一下背景吧.这是一款国外的Blackjack也就是21点算牌软件,我从来不玩牌的,机 ...

  6. 2017第十三届湖南省省赛B - Simplified Blackjack CSU - 1998

    在一次聚会上,Bob打算和Alice一起玩Blackjack游戏,但Alice平时很少玩扑克类游戏,Bob觉得跟Alice解释清楚Blackjack的规则有点困难,于是Bob决定和Alice玩一次简化 ...

  7. [360前端星计划]BlackJack(21点)(纯JS,附总部学习笔记)

    [360前端星计划]总部学习笔记(6/6) [360前端星计划]详情跳转 游戏界面预览 目录 一.游戏介绍 1.起源 2.规则 3.技巧 二.游戏设计 1.整体UI构思 2.素材采集 3.游戏总规划 ...

  8. 【pwnable.kr】blackjack

    又一道pwnable nc pwnable.kr 9009 读题找到源代码在:http://cboard.cprogramming.com/c-programming/114023-simple-bl ...

  9. [MIT6.006] 20. Daynamic Programming II: Text Justification, Blackjack 动态规划II:文本对齐,黑杰克

    这节课通过讲解动态规划在文本对齐(Text Justification)和黑杰克(Blackjack)上的求解过程,来帮助我们理解动态规划的通用求解的五个步骤: 动态规划求解的五个"简单&q ...

随机推荐

  1. 笛卡尔树--牛客第四场(sequence)

    思路: O(n)建一颗笛卡尔树,再O(n)dfs向上合并答案就行了. #define IOS ios_base::sync_with_stdio(0); cin.tie(0); #include &l ...

  2. 分布式的几件小事(三)dubbo的通信协议与序列化

    1.dubbo的通信协议 ①dubbo协议 Dubbo缺省协议采用单一长连接和NIO异步通讯,适合于小数据量大并发的服务调用,以及服务消费者机器数远大于服务提供者机器数的情况. 特点 : dubbo缺 ...

  3. 02 Python数据结构的性能分析

    一.列表: - python 的设计者在实现列表数据结构的时候有很多选择.每一个这种选择都可能影响列表操作的性能.为了帮助他们做出正确的选择,他们查看了最常使用列表数据结构的方式,并且优化了实现,以便 ...

  4. 谈谈对this的指向问题

    普通函数中:this——window 定时器:this——window 构造函数中:this——当前实例化的对象 事件处理函数:this——事件触发对象

  5. Vue中自定义指令的使用方法!

    除了核心功能默认内置的指令 (v-model 和 v-show),Vue 也允许注册自定义指令.注意,在 Vue2.0 中,代码复用和抽象的主要形式是组件.然而,有的情况下,你仍然需要对普通 DOM ...

  6. webpack 打包 UglifyJs 报错

    Vue-cli 打包报错: ERROR in static/js/4.784ab4a1238de8e94312.js from UglifyJs Unexpected token: 原因:Uglify ...

  7. GO语言语法入门

    引言 Go Go语言是谷歌2009发布的编程语言,它是一种并发的.带垃圾回收的.快速编译的语言. 它结合了解释型语言的游刃有余,动态类型语言的开发效率,以及静态类型的安全性.它也打算成为现代的,支持网 ...

  8. Array.reduce()方法

    Array.reduce()方法是对数组的遍历,返回一个单个返回值   使用方法: Array.reduce((acc, cur, idx, src) => { }, initialValue) ...

  9. 【版本控制工具】 Git进阶1

    一.Git常用命令 Git中的很多命令与Linux相同(比如修改,查询,编辑,移动等),这里可以参考我之前的一篇文章https://www.cnblogs.com/ywb-articles/p/105 ...

  10. 关于tp5.0中对象数组转换普通数组使用助手函数collection而不是toArray

    tp5.0新版的模型查询返回默认对象,系统默认增加了toArray方法,许多开发者在all或select尝试使用toArray来转换为数组,在此希望开发者能理解对象的概念,尝试使用对象进行数据的使用, ...