zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    shell学习(三)
    shell学习(四)
    自定义yum源
    fpm制作rpm包
    shell学习(三)
    shell学习(二)
    linux系统下创建lvm挂载到指定目录
    nginx做代理安装docker
    df -h命令卡死解决办法
    docker安装
  • 原文地址:https://www.cnblogs.com/gaojunonly1/p/10738164.html
Copyright © 2011-2022 走看看