【题意】#80 A. Blackjack

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: 23456,78910, 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 10points, 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.

Sample test(s)
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张牌,分为四种花色,JQK和10一样都算10分,A可以当1分可以当11分,现在已经有一张黑桃Q了(10分),给出一个数字n,问再抽一张牌,他们的和为n的抽法有多少中种。

那么我们来等价一下题意:从A到K四种花色各一张,黑桃Q除外,A可以当1或者11,JQK为10,问值为 n-10 的牌有多少张。

牌的点数都大于等于1,所以如果n-10<=0,答案为0

反之,看有多少种了呗~记住黑桃Q用掉了所以如果需要10的话记得减一~

Code:

#include <cstdio>
#include <string>
#include <cstring> 
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
// http://codeforces.com/contest/104
// Black Jack
int ans[26]={0};

int main()
{
	int n;	cin>>n;
	for(int i=11;i<20;i++)ans[i]=4;
	ans[20]=15;	ans[21]=4;
	cout<<ans[n];
	return 0;
} 





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

糖果天王

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值