第十四届蓝桥杯pythonB组真题——2023

蓝桥杯学习记录-基础练习 注:每天都更新哦~,题目下面的代码都是经过测试正确的,欢迎有更好算法的大神指正,我会把您的代码也附上,相互学习。 蓝桥杯-基础练习:所有题 十六进制转八进制 进制转换 字符 循环 十六进制转十进制 进制转换 字符处理 判断 十进制转十六进制 循环 整除 求余 判断 特殊回文数 回... 阅读详情
AI摘要

本文介绍了如何使用Python的find函数递归地检查12345678到98765432之间的数字字符串,判断它们是否完全不包含2023。通过find函数找到特定字符的位置,确定符合条件的数字数量。

问题描述:

     请求出在 12345678(含)至98765432(含)中,有多少个数中完全不包含2023。完全不包含2023是指无论将这个数的哪些数位移除都不能得到2023。例如20322175、33220022都完全不包含2023,而20230415,20193213则含有2023(后者取第1,2,6,8个数位)

关键是认识 find函数。

       find函数用于判断字符串是否含有子串str:

               若包含子串,则返回所在字符串第一个位置的下标

               若不包含子串,返回-1

       语法:str.find(str, beg=0, end=len(string))

               str : 指定检索的字符串(子串)

               beg :开始索引,默认为0。

               end :结束索引,默认为字符串的长度。

       举例:

              >>>info = 'abca'
              >>> print(info.find('a'))      # 从下标0开始,查找在字符串里第一个出现的子串,返回结果:0
              >>> print(info.find('a', 1))   # 从下标1开始,查找在字符串里第一个出现的子串:返回结果3

              >>> print(info.find('3'))      # 查找不到返回-1
              >>>print(info.find('abcac'))   # 子串比原字符串长,返回-1
 

完整代码如下:

def find_i(i):
    find_1 = i.find('2')
    if find_1 == -1:
        return 0

    find_2 = i.find('0',find_1+1)
    if find_2 == -1:
        return 0

    find_3 = i.find('2',find_2+1)
    if find_3 == -1:
        return 0

    find_4 = i.find('3',find_3+1)
    if find_4 == -1:
        return 0
    
    return 1

ans = 0
for i in range(12345678,98765432+1):
    if find_i(str(i)) == 0:
        ans += 1

print(ans)

参考:1.Python中的find()函数_python find-CSDN博客 2.蓝桥杯真题题解——来一瓶养乐多

蓝桥杯第十二届青少年Python组省赛试题 【代码】十二届蓝桥杯青少年Python组省赛试题。 阅读详情

相关推荐

第14届蓝桥杯Python省赛真题-大学B组

第14届蓝桥杯Python省赛真题-大学B组

m0_65527280的博客 2021

蓝桥杯2023年真题 python B组

Python 大学 B 组。

qq_62029644的博客 9532

2023第十四届蓝桥杯Python大学生B组真题?(真题+附链接)

【问题描述】 小蓝手中有 2023 种不同面值的硬币,这些硬币全部是新版硬币,其中第 i(1 ≤ i ≤ 2023) 种硬币的面值为 i ,数量也为 i 个。硬币兑换机可以进行硬币兑 换,兑换规则为:交给硬币兑换机两个新版硬币 coin1 和 coin2 ,硬币兑换机会 兑换成一个面值为 coin1 + coin2 的旧版硬币。小蓝可以用自己已有的硬币进行任意次数兑换,假设最终小蓝手中有 K 种 不同面值的硬币(只看面值,不看新旧)并且第 i(1 ≤ i ≤ K) 种硬币的个数为 sumi。

m0_74939018的博客 2807

蓝桥杯【第12届真题】Python 实现

菜鸟赛前练手咯,我的代码得分主要在 C 语言网上测的。这个题集是所有组别的,只是我用 Python 实现而已

荷碧TongZJ 的水文 1万+

【DICOM后处理】qt+vs 实现DICOM数据四视图显示

方法用于 设置 2D 视图的“向上”方向,即定义图像在屏幕坐标系中的朝向。该方法直接影响影像的显示方向,尤其在多平面重建(MPR)或非标准切面显示时至关重要。:方法用于 设置渲染窗口在屏幕上的显示位置(以像素为单位)。它控制的是 VTK 渲染窗口的左上角在屏幕坐标系中的坐标位置。DICOM四视图通常指同时显示医学影像的四个不同平面或视角,用于全面分析三维数据(如CT、MRI等)。:基于 标量值 设置不透明度(控制不同组织的显示),显示骨骼or显示高密度流体等。默认朝向原点 (0, 0, 0)

weixin_41804847的博客 1328

新手必看!Stata工具变量分析中的三大陷阱:如何正确解读LM统计量、CDW检验和Hansen J值

本文深度解析Stata工具变量分析中的三大核心检验:不可识别检验、弱IV检验和过度识别检验,帮助新手避开常见陷阱。详细解读LM统计量、CDW检验和Hansen J值的正确使用方法,提供实战案例和Stata操作指南,确保研究结论的可靠性。

weixin_29231027的博客 582

第十四届蓝桥杯Python B组省赛复盘

第十四届蓝桥杯Python B组省赛复盘

qq_57150526的博客 3188

uniapp - 最新详细实现web-view网页与安卓苹果App端之间互相通信功能,苹果app/安卓app平台与内嵌webview组件内的网页进行相互传值,内置网页与app双向实时通信,详细示例代码

uni-app,Android安卓,苹果ios,app,内嵌webview,第三方H5网页,app和web-view通信传值,web-view引入的页面向App主应用传递数据,App端与webview端相互通信,App端和H5端webview之间的通信,uniapp实现webview和APP之间的传值通信,如何互相传递对象数据,数据传递了接收不到,web-view页面向app内发送消息,监听传递的参数,uni-app和web-view页面相互传参,报错怎么办,跨域,屏幕空白出错,数据交互,解决手机物理返回按

🏆 前端领域优质创作者 4747

2023年第十四届蓝桥杯省赛Python大学B组真题解析

写这份题解之前我是没有看过任何版本的题解,以下代码均是我独立AC后把代码记录到该题解内。代码提交后是能保证100%通关的,并且配有注释,可以放心食用。

KevenDuan的博客 7171

跨平台也要跑得像原生一样顺:SAP GUI for Java 的安装、配置、运维与自动化实战

摘要:SAP GUI for Java 作为跨平台客户端解决方案,在 S/4HANA 时代仍发挥关键作用,特别适用于 macOS/Linux 环境下的 ABAP 开发和系统运维。其主要优势包括:平台无关性(支持 Windows/macOS/Linux/UNIX)、与 Windows 版本一致的交互体验、对核心事务码(如 ST22/SM21)的完整支持。版本管理需注意 7.80 已停止支持,建议升级至 8.10。安装支持原生包和通用 JAR 两种方式,推荐团队标准化版本和连接配置(通过 SAP UI Land

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 689

【即插即用模块】卷积篇 | TGRS 2025 | HLKConv:小核+空洞=大核,感受野一致,但更轻更准!

本文介绍了分层大核卷积模块HLKConv,该模块通过动态大核+空洞卷积实现高效感受野扩展,将超大核卷积分解为小核+空洞卷积(如53×53核用17×17+dilation=3实现),计算量仅为普通大核的1/10。模块采用双分支设计:基础卷积分支捕捉局部细节,大核空洞分支捕捉长距离关联,通过1×1卷积融合。实验表明HLKConv在红外小目标检测中优于传统大核卷积,适用于高分辨率视觉任务。代码实现了不同核尺寸的配置,输入输出特征维度保持不变,计算效率显著提升。

主要更新底层视觉(去噪、超分等)相关的科研内容,形式为【论文精读】+【论文复现】 354

第十四届蓝桥杯大赛软件赛省赛pythonB(含代码)

第十四届蓝桥杯大赛软件赛省赛Python 大学 B 组

m0_52225681的博客 5308

12、无人机系统的建模与仿真

本文深入探讨了无人机系统的建模与仿真技术,涵盖其发展需求、历史演变、动力学建模方法、常用参考框架与状态变量表示,并分析了在控制系统设计、操作员培训和子系统测试中的关键应用。文章还介绍了不同类型无人机(固定翼、旋翼、混合翼)在建模与仿真中的差异,提出了多学科融合、高精度实时仿真及VR/AR技术等未来发展趋势,并给出了实际建模与仿真的标准操作流程,为无人机系统的设计与优化提供了全面的技术支持与展望。

websocket5live的博客 201

【蓝桥真题】——第十四届蓝桥杯模拟赛 大学B组 Python

全网最详细蓝桥杯真题+解析+代码,绝对通俗易懂,一点就通!专治各种没资源,没思路,没代码等新手入门级BUG。

weixin_43741934的博客 1444

SAP自动化-ME51N批量创建采购申请

2、需要管理员授权RZ11脚本录制回放功能。1、仅限于正对SAP日常工作的批量处理。3、数据模板按实际需求更新。物料编码,工厂,数量。

小九啥也不会 533

基于YOLO26/11/v8算法的Web目标检测系统,人脸表情识别系统,Django+Vue3 的前后端分离,实现摄像头实时识别,YOLO26/YOLO11/v8 + LLM大模型智能分析,科研必备

在人工智能迈向通用化(AGI)的今天,“视觉感知 + 语言理解”的多模态联合是未来的趋势。单纯的检测画框已经无法满足复杂的业务需求,如何让系统“看懂”画面并进行“思考”,是当前视觉项目的重点。我们知道目标检测是计算机视觉中的重要任务,广泛应用于安防监控、自动驾驶、智能家居等领域。因此本项目将 YOLO 目标检测模型(兼容 YOLO26/v11/v8 系列)与 DeepSeek 等顶流大语言模型(LLM) 进行联合,使用 Django (后端) + Vue3 (前端) 技术栈

在职AI算法工程师,擅长计算机视觉,YOLO目标检测、分割等,擅长web、pyqt界面可视化,好内容持续更新中,来这里跟大家一起学习,共同进步 2864

第十四届蓝桥杯大赛B组真题

是不是二维数组的最外面一圈的海域一定是外海啊.所以我们就可以用dfs一次遍历外海,如果遇到岛屿了在用一次dfs遍历岛屿,将所有的岛屿都标记.这样从外海开始dfs,找到岛屿后在一个dfs就可以将最外层的岛屿找到.因为如果这个岛屿是环岛的话,我们的找海的dfs就进不去环岛里面的海域,就自然不会遍历环岛里面的岛屿.而题目给出的只有(x, y)这坐岛屿的上下左右都有岛屿的话才是同一个岛屿,而遍历海则有八个方向遍历,这里要注意了.每条记录都是独立的,这意味着上一次没消耗完的普通金属O不会累加到下一次的冶炼当中。

qq_74276498的博客 1635

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

第十四届蓝桥杯PythonB组

😎🥳😎🤠😮🤖🙈💭🍳🍱答案未证实,仅供参考如果你对这篇文章感兴趣,欢迎在评论区留言,分享你的想法和建议。

weixin_62650212的博客 3742

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

蓝桥杯2023省赛PythonB组——2023

【代码】蓝桥杯2023省赛PythonB组——2023。

m0_74917610的博客 341

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

2023年pythonB组省赛题解

蓝桥杯备赛

m0_61667323的博客 4006

pythonB组2023年真解析--A:2023

试题A:2023 【问题描述】 请求出在 12345678(含) 至 98765432(含) 中,有多少个数中完全不包含 2023 。 完全不包含 2023 是指无论将这个数的哪些数位移除都不能得到 2023 。 例如 20322175,33220022 都完全不包含 2023,而 20230415,20193213 则 含有 2023 (后者取第 1, 2, 6, 8 个数位) 。 【答案提交】 这是一道结果填空的题,你只需要算出结果后提交即可。本题的结果为一 个整数,在提交答案时只填写这个

qq3342560494的博客 3473

蓝桥杯2023省赛PythonB组——管道

这道题考察的是二分法思想,代码如下。

m0_74917610的博客 257

蓝桥杯2023省赛PythonB组——树上选点

这道题考察的是自下而上的树形dp思想,以下是代码的详细理解记录。

m0_74917610的博客 456

蓝桥杯PythonB组打卡十九天——填空题

十进制转化为九进制。

2301_81150224的博客 391

蓝桥杯2023省赛PythonB组——松散子序列

题目描述得应该不对,如果按照题意要求“i>1,总有pi-pi-1≥2“,测试用例的结果应该是79,也就是说这个子序列中p=0和p=1可以同时出现。但是实际情况是,不能同时出现,按照这道题通过的情况来看,感觉应该是要求”i>0,总有pi-pi-1≥2“。补充:如果s的长度为1的情况没考虑进去,会出现段错误的情况。

m0_74917610的博客 558

蓝桥杯2023省赛PythonB组——保险箱

这道题考察的是动态规划,主要是要理解三个状态:不进不退、进位、退位,代码如下。

m0_74917610的博客 374
上一篇: 将 a 数组中相同的数据删得只剩一个,然后以每行 4 个数据的格式输出 a 数组。
下一篇: DAY1算法基础课——快速排序
先做出一堆shit,再慢慢改
博客等级 码龄5年 76粉丝 17原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值