• 【蓝桥杯第十三届省赛B组】(部分详解)


    九进制转十进制

    #include 
    #include
    using namespace std;
    int main()
    {
      cout << 2*pow(9,3)+0*pow(9,2)+2*pow(9,1)+2*pow(9,0) << endl;
      return 0;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    顺子日期

    #include 
    using namespace std;
    int main()
    {
      // 请在此输入您的代码
      cout<<14;
      //01.20~01.29
      //11.23\10.12\12.30\12.31
      return 0;
      }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    只比较后面四位就可以,如果代码算的话直接后面几位差值为1与求就ok,思考的时候写着写着就出答案了

    修剪灌木

    #include 
    using namespace std;
    int main()
    {
        int n;
        cin>>n;
        for(int i=1;i<=n;i++)
        {
           cout<<max(i-1,n-i)*2<<endl;
        }
      return 0;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    在这里插入图片描述

    X进制减法

    #include 
    using LL=long long;
    using namespace std;
    const LL MOD=1000000007;
    const LL N=1e5+5;
    int a[N],b[N];
    
    int main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0),cout.tie(0);
        int n;  cin>>n;//进制min 2  max n
        int ma; cin>>ma;//A的位数
        for(int i=ma-1;i>=0;i--) cin>>a[i]; //A每一位的十进制表示
        int mb;  cin>>mb;//B位数
        for(int j=mb-1;j>=0;j--)  cin>>b[j]; //B的每一位表示
        
         LL cnt=1,res=0,rgb;//cnt不能等于0
        for(int i=0;i<ma;i++)
        {
           
            rgb=max(max(a[i],b[i])+1,2);
            //进制越小差距越小,二进制最高位只能是0,十进制是9,所以数字加一取最小进制
            res=(res+(a[i]-b[i])*cnt)%MOD;
            cnt=(cnt*rgb)%MOD;
            //cnt放后面是因为 从0次方开始乘
            //多次取模为了防止越界
           
        } cout<<res%MOD;
        // 请在此输入您的代码
      return 0;
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33

    刷题统计

    #include
    using LL=long long;
    using namespace std;
    int main()
    {
        LL a,b,n;
        LL res=0;
        cin>>a>>b>>n;
        LL week=a*5+2*b;//90
        LL div=n/week;//1
        LL rem=n%week;//9
        if(rem> 5*a) 
        res = 5 + ceil(1.0*(rem-5*a)/b);
        else 
        res = ceil(1.0*rem/a);
    	cout<<(int)res+ div*7;
        return 0;
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19

    ceil要转浮点再转整型才行(爆哭)

    扫雷

    #include 
    #define cir(i,a,b) for(int i=a;i<=b;i++)
    using namespace std;
    const int N=105;
    int a[N][N]={0};
    int main()
    {
        int n,m;
        cin>>n>>m;
        cir(i,1,n)
        {
            cir(j,1,m)
            {
                 cin>>a[i][j];
            }
        }
        cir(i,1,n)
        {
            cir(j,1,m)
            {
                if(a[i][j] == 1)
                    cout << "9 ";
                else {
                    int sum = 0;
                    if (i > 1 && j > 1) sum += a[i-1][j-1];
                    if (i > 1) sum += a[i-1][j];
                    if (i > 1 && j < m) sum += a[i-1][j+1];
                    if (j > 1) sum += a[i][j-1];
                    if (j < m) sum += a[i][j+1];
                    if (i < n && j > 1) sum += a[i+1][j-1];
                    if (i < n) sum += a[i+1][j];
                    if (i < n && j < m) sum += a[i+1][j+1];
                    cout << sum << " ";
                }
            }
            cout << "\n";
        }
    
      return 0;
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
  • 相关阅读:
    差值结构的顺序偏好
    pg_database中的datlastsysoid
    K8S基础知识学习
    Nacos-2.2.2源码修改集成高斯数据库GaussDB,postresql
    【Demo】SpringBoot集合Mybatis修改账户密码逻辑
    Multihead Attention - 多头注意力
    线上 udp 客户端请求服务端客户端句柄泄漏问题
    Sentienl【动态数据源架构设计理念与改造实践】
    【知识专栏丨python数分实战】电商数据分析案例
    docker概念、安装与卸载
  • 原文地址:https://blog.csdn.net/2301_76518242/article/details/137173057