codeforces104A

Posted gaojunonly1

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了codeforces104A相关的知识,希望对你有一定的参考价值。

Blackjack

 CodeForces - 104A 

Tensor特别喜欢玩扑克,还总是爱发明一些关于扑克牌的游戏,有天他突然脑洞大开想到了这样的一个游戏:

现在有一副52张的扑克牌(没有大小王),规定每一张牌都有他自己的values,2~10点数分别对应2~10的values,QJK代表的values都是10,A代表的点数是1或者11。现在游戏的参与者手中已经有一张黑桃10。

Tensor给参与者一个数n,问当参与者取第二张牌使和为n的方法数是多少?

Input

输入一个整数n(n<=25)。

Output

输对应的方法数。

Example

Input
12
Output
4
Input
20
Output
15
Input
10
Output
0

Note

不同花色算不同方法数
 
sol:为什么Div2A这么水
技术图片
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
inline ll read()
{
    ll s=0;
    bool f=0;
    char ch= ;
    while(!isdigit(ch))
    {
        f|=(ch==-); ch=getchar();
    }
    while(isdigit(ch))
    {
        s=(s<<3)+(s<<1)+(ch^48); ch=getchar();
    }
    return (f)?(-s):(s);
}
#define R(x) x=read()
inline void write(ll x)
{
    if(x<0)
    {
        putchar(-); x=-x;
    }
    if(x<10)
    {
        putchar(x+0);    return;
    }
    write(x/10);
    putchar((x%10)+0);
    return;
}
#define W(x) write(x),putchar(‘ ‘)
#define Wl(x) write(x),putchar(‘
‘)
int n,ans[]={0,4,4,4,4,4,4,4,4,4,15,4};
int main()
{
    n=read()-10;
    Wl(ans[n]);
    return 0;
}
/*
Input
12
Output
4

Input
20
Output
15

Input
10
Output
0
*/
View Code

 

以上是关于codeforces104A的主要内容,如果未能解决你的问题,请参考以下文章

[Codeforces Round #522 (Div. 2, based on Technocup 2019 Elimination Round 3)][C. Playing Piano](代码片段

c_cpp Codeforces片段

Codeforces 86C Genetic engineering(AC自动机+DP)

CodeForces 1005D Polycarp and Div 3(思维贪心dp)

(Incomplete) Codeforces 394 (Div 2 only)

CodeForces 931F Teodor is not a liar!