第十四届蓝桥杯第三期模拟赛(自我激励版)

欢迎大家指点~

还在更新中,因为自己也是边做边琢磨!

第一题:(填空题)

想法:

  1. 使用死循环找到目标数

  1. 在十六进制里面,A代表10,F代表15,所以目标数%16只能在10~16之间

代码:

#include<bits/stdc++.h>
using namespace std;

bool check(int x) {
    while(x) {
        if(x % 16 >= 10 && x % 16 <= 15){
            x=x/16;
        } 
        else {
            return false;
        }
    }
    return true;
}

int main() {
    for(int i = 2023; ; i ++) {
        if(check(i)) {
            cout << i << "\n";
            break;
        }
    }
    return 0;
}

答案:

2730

第二题:(填空题)

想法:(暴力)

  1. 计算出有多少位字母

一位字母:26 种情况

两位字母:26*26=676 种情况

三位字母:26*26*26=17576 种情况

即2022列为三位字母

  1. 2022-676-26=1320

1320/26/26=1 即第一位字母为B(因为第一位字母为A的情况有26*26=676种<1320)

1320-676=644,即以B的首字母的第644个组合

  1. 644/26=24,即组合中的第二位字母为字母表中的第24位字母Y

  1. 644-26*24=20 ,即组合中的第三位字母为字母表中的第20位字母T

答案:

BYT

第三题:(填空题)

想法:

死循环,暴力解决

这题目和其他博主给的答案不一致,大家看的时候仔细一点!

代码:

#include<bits/stdc++.h>
using namespace std;
//2022年11月13日满足要求,因为 2+0+2+2=(1+1)+(1+3) 。

int main(){
    int year;  //年   1900~9999
    int month; //月   1~12
    int day;   //日   1~31
    int n=0;
    
    for(year=1900;year<=9999;year++){
        for(month=1;month<=12;month++){
            
        
          if(year%4==0){ //判断为闰年,则二月就有29天 
            switch(month){
                case 1: day=31;
                case 2: day=29;
                case 3: day=31;
                case 4: day=30;
                case 5: day=31;
                case 6: day=30;
                case 7: day=31;
                case 8: day=31;
                case 9: day=30;
                case 10: day=31;
                case 11: day=30;
                case 12: day=31;
            }    
        }
        if(year%4!=0){   //不是闰年 
            switch(month){
                case 1: day=31;
                case 2: day=28;
                case 3: day=31;
                case 4: day=30;
                case 5: day=31;
                case 6: day=30;
                case 7: day=31;
                case 8: day=31;
                case 9: day=30;
                case 10: day=31;
                case 11: day=30;
                case 12: day=31;
            }    
        }
        
        int y1=year/1000;
        int y2=year/100%10;
        int y3=year/10%10;
        int y4=year%10;
    
        int m1=month/10;
        int m2=month%10;
        
        int d1=day/10;
        int d2=day%10;

       if(y1+y2+y3+y4==d1+d2+m1+m2){
                    n++;
                }
            }
    }
    cout<<n;
}

答案:

1421

第四题(填空题)

想法:

死循环,暴力解决

代码:

#include<bits/stdc++.h>
using namespace std;

int main(){
    int a[]={99, 22, 51, 63, 72, 61, 20, 88, 40, 21, 63, 30, 11, 18, 99, 12, 93, 16, 7, 53, 64, 9, 28, 84, 34, 96, 52, 82, 51, 77 };
    int n=0;
    for(int i=0;i<30;i++){
    for(int j=i+1;j<30;j++){
        if(a[i]*a[j]>=2022){
            n++;
        }
    }
    }
    cout<<n;
}

答案:

189

第五题(填空题)

小蓝有一个 30 行 60 列的数字矩阵,矩阵中的每个数都是 0 或 1 。

  110010000011111110101001001001101010111011011011101001111110

  010000000001010001101100000010010110001111100010101100011110

  001011101000100011111111111010000010010101010111001000010100

  101100001101011101101011011001000110111111010000000110110000

  010101100100010000111000100111100110001110111101010011001011

  010011011010011110111101111001001001010111110001101000100011

  101001011000110100001101011000000110110110100100110111101011

  101111000000101000111001100010110000100110001001000101011001

  001110111010001011110000001111100001010101001110011010101110

  001010101000110001011111001010111111100110000011011111101010

  011111100011001110100101001011110011000101011000100111001011

  011010001101011110011011111010111110010100101000110111010110

  001110000111100100101110001011101010001100010111110111011011

  111100001000001100010110101100111001001111100100110000001101

  001110010000000111011110000011000010101000111000000110101101

  100100011101011111001101001010011111110010111101000010000111

  110010100110101100001101111101010011000110101100000110001010

  110101101100001110000100010001001010100010110100100001000011

  100100000100001101010101001101000101101000000101111110001010

  101101011010101000111110110000110100000010011111111100110010

  101111000100000100011000010001011111001010010001010110001010

  001010001110101010000100010011101001010101101101010111100101

  001111110000101100010111111100000100101010000001011101100001

  101011110010000010010110000100001010011111100011011000110010

  011110010100011101100101111101000001011100001011010001110011

  000101000101000010010010110111000010101111001101100110011100

  100011100110011111000110011001111100001110110111001001000111

  111011000110001000110111011001011110010010010110101000011111

  011110011110110110011011001011010000100100101010110000010011

  010011110011100101010101111010001001001111101111101110011101

  如果从一个标为 1 的位置可以通过上下左右走到另一个标为 1 的位置,则称两个位置连通。与某一个标为 1 的位置连通的所有位置(包括自己)组成一个连通分块。

  请问矩阵中最大的连通分块有多大?

想法:

这题太难了,我不会,参考别人的吧

第六题:(代码题)

想法:

没什么想法,送分题

代码:

#include<bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a;
    cin>>b;
    int c=(a+b)%7;
    cout<<c;
    return 0;
}

第七题(代码题)

第八题(代码题)

第九题(代码)

第十题(代码)

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值