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. C++;STL--队列与栈;

    队列 queue模板类的定义在<queue>头文件中. queue 模板类也需要两个模板参数,一个是元素类型,一个容器类型,元素类型是必要的,容器类型是可选的,默认为deque 类型. 定 ...

  2. c语言:<tchar.h>

    头文件“<tchar.h>”作用就是为了进行ASCII码和UNICODE(wide-character)码的头文件(该头文件由微软提供): 这样我们就可以使用TCHAR.H头文件中的定义的 ...

  3. jQuery导出word文档

    DDoc.js function DDoc() { this.data = []; this.relationData = []; this.listCount = 0; this.counter = ...

  4. innodb中一颗B+树能存储多少条数据

    如图,为B+树组织数据的方式: 实际存储时当然不会每个节点只存3条数据. 以InnoDB引擎为例,简单计算一下一颗B+树可以存放多少行数据. B+树特点:只有叶子节点存储数据,而非叶子节点存放的是用来 ...

  5. numpy:np.random.seed()

    np.random.seed()函数可以保证生成的随机数具有可预测性. 可以使多次生成的随机数相同 1.如果使用相同的seed( )值,则每次生成的随即数都相同: 2.如果不设置这个值,则系统根据时间 ...

  6. centos配置mutt和msmtp发送邮件

    一.安装mutt yum install mutt -y 二.配置mutt vim /etc/Muttrc 在里面找到下面几行,并将内容修改为你自己的内容(下面几行分布在不同位置,请耐心查找,记得去掉 ...

  7. js判断变量是否为undefined

    可能很多朋友认为undefined是在js中未定义变量时才会提示的错误,其实不然undefined 是js中的一特殊的变量,我们也可以提前定义哦,下面我来介绍js undefined 用法. Java ...

  8. LRU算法介绍和在JAVA的实现及源码分析

    一.写随笔的原因:最近准备去朋友公司面试,他说让我看一下LRU算法,就此整理一下,方便以后的复习. 二.具体的内容: 1.简介: LRU是Least Recently Used的缩写,即最近最少使用. ...

  9. double to long

    obj to double obj to long instance of Bigdecimal public static void main(String[] args) throws Parse ...

  10. 读《JavaScript面向对象编程指南》(一)

    第二章 基础 通常认为在JavaScript中主要包括五种基本数据类型:数字.字符串.布尔值.undefined.null.任何不属于上述五种基本类型的值都被认为是一个对象. null和undefin ...