codeforces 1023a

【实战】ESP32 + LN298N 实现电动推杆的闭环位置伺服控制 本文详细介绍了如何使用ESP32微控制器和LN298N电机驱动模块,为普通电动推杆增加编码器反馈,实现精准的闭环位置伺服控制。文章从硬件选型与接线讲起,深入解析了编码器四倍频计数原理与位置换算,并重点阐述了PID控制算法的核心思想、代码实现及参数整定方法,旨在帮助读者从零构建一个反应迅速、定位精准的智能执行器系统。 阅读详情

题目链接:http://codeforces.com/contest/1023/problem/A

#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
#define mod 1000000007
#define For(i,m,n) for(int i=m;i<=n;i++)
#define Dor(i,m,n) for(int i=m;i>=n;i--)
#define LL long long
#define lan(a,b) memset(a,b,sizeof(a))
using namespace std;

     char a[200005],b[200005];
    int n,m;
        int id;
bool pin()
{
    int sum=0;
        For(i,0,n-1)
        if(a[i]=='*')
            {sum++;id=i;break;}
        if(sum==0)
        {
            if(n!=m)
                return false;
            For(i,0,n-1)
            if(a[i]!=b[i])
                return false;
        }


        int c=inf,d=-1;
     for(int i=0;i<id;i++)
            if(a[i]!=b[i])
                return false;
    c=id-1;
    for(int i=n-1;i>id;i--)
        if(a[i]!=b[m-(n-i)])
        return false;
    d=m-(n-id-1);
   // printf("%d %d\n",c,d);
    if(d>=c)
        return true;
    else
        return false;
}


int main()
{
    while(~scanf("%d%d",&n,&m))
    {
        lan(a,0);
        lan(b,0);
        scanf("%s%s",a,b);
        if(n>m+1)
        {
            printf("NO\n");
            continue;
        }
       if(pin())
        printf("YES\n");
       else
        printf("NO\n");

    }
    return 0;
}

 

示波器学习(一):示波器的作用、类型和基本结构 示波器的作用、使用场景;示波器的类型和基本结构介绍 阅读详情

相关推荐

Unity3d实现红外热成像效果

1.将需要在红外图像中高亮的物体设置到图层PostProcessing。 2.新建一个相机CameraHighLight,设置其Culling Mask为PostProcessing,也就是在这个相机中只有PostProcessing图层的物体可见。 3.新建一个RenderTexture,命名为HightLightRt,将CameraHighLight的Target Texture设HightLightRt。 4.新建一个相机Camera2,这个相机用于显示其他物体。 接下来将CameraHigh

zouxin_88的专栏 8328

Codeforces Round 1023 (Div. 2) ABC

ABC

its_a_win的博客 673

Flotherm XT学习历程

大家好,通过半年的热仿真软件学习使用,最终发现最好用,最好上手的软件就是Flotherm XT,对新手非常友好,但由于软件近几年才发布,网上教程非常少,后面我将在这里持续分析软件使用心得,和大家一起学习。

xiaoredred的博客 6264

Codeforces Round 1022 (Div. 2) 题解

B SUMdamental Decomposition C Neo’s Escape D Needle in a Numstack E Spruce Dispute F Fallen Towers 皮萨诺建造了由 nnn 座塔楼组成的 aaa 阵列,每座塔楼由 ai≥0a_i \ge 0ai​≥0 块砖块组成。皮扎诺可以推倒一座塔,使接下来的 aia_iai​ 座塔增加 111 个。换句话说,他可以利用 aia_iai​ 元素,将接下来的 aia_iai​ 元素增加一个,然后将 aia_iai​ 设

nike0good |Oier&ACMer | 熟能生巧 1407

超详细 VMware Horizon 虚拟桌面VDI安装步骤

主要的目的是模拟生产环境中的共享存储。自动桌面相当于共享电脑,大家使用同一个虚拟机,对虚拟机的修改都放在用户的配置文件中,RDS桌面池相当于共享的服务器,可以多人同时连接到服务器上。1:之前已经建立好了NFS的存储,这部分配置好后,以后的虚拟机可以安装到NFS的存储中。2: 使用Composer发布系统可以解决SID,机器名冲突的问题,更重要的可以节约磁盘空间,发布的所有系统可以访问一块磁盘。26: 域选择我们之前建立的域,用户名我输入的是管理员,可以在AD域新建用户点击查找,我这里用的是管理员。

vv12345的博客 1万+

基于CatBoost回归模型的完整预测分析:从建模到SHAP可解释性分析

本文介绍了使用CatBoost回归模型进行完整预测分析的流程。首先导入必要的Python库并加载数据,进行数据预处理包括训练测试集划分和归一化处理。然后通过网格搜索优化CatBoost超参数,使用最优参数训练模型并评估预测性能。结果显示模型具有较高的决定系数(R²=0.9944)和较低的误差指标(RMSE=0.0696)。接着进行残差分析和正态性检验,发现残差基本服从正态分布。最后通过SHAP分析实现模型可解释性,识别关键特征影响。该方法为梯度提升树在回归问题中的应用提供了完整解决方案。

fx666_的博客 747

Codeforces Round 1023 Div2 A-C题解

这场其实D思路也很简单,就是一道树的直径的板子题,但是很麻烦没写出来,主要C本身也是比较麻烦的模拟题,所以这个D就没想做,这场模拟场,主要就是写起来会麻烦不少。

W_Sherlock_Henry的博客 922

SPEI计算避坑指南:gma中Distribution和FitMethod参数怎么选?

本文深入探讨了在SPEI计算中如何科学选择gma库中的Distribution和FitMethod参数,帮助研究者避开常见陷阱。详细分析了LogLogistic、Gamma和Pearson3三种分布的适用场景,以及LMoment与MLE拟合方法的优缺点,为气象干旱研究提供实用指南。

weixin_30308101的博客 250

【CF】Day58——Codeforces Round 1024 (Div. 2) CD + Codeforces Round 958 (Div. 2) CD

比较猜的一题感性的想,我们肯定是要让 0 在的子矩阵数量越多越好,因为如果没 0,那么mex就是 0,所以 0 我们肯定要放中间,同时我们将这个想法扩展一下,对于所有的数,我们肯定要越靠近之间的数越多越好,比如 1 肯定要靠近 0,2 肯定要靠近 0 1,以此类推最后我们可以发现螺旋画圈的一种构造方式刚好符合我们的需求,模拟的时候注意即可。

qq_61422664的博客 746

DICOM三维重建:基于VTK实现三种面绘制算法

版本:VS2019、VTK9.0.1 #define vtkRenderingCore_AUTOINIT 3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL2) #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL2) #include "vtkDICOMImageReader.h" #include "vtkRenderWindowInteractor.h" #i

一直在笑的博客 5923

基于 YOLOv26 的校园安全监控系统:多场景应用

本文提出了一种基于YOLOv26的校园安全监控系统,采用多场景应用架构实现对校园安全的智能监测。系统核心技术包括YOLOv26目标检测、DeepSORT目标跟踪、区域安全定义和行为分析等模块,通过边缘计算平台实现实时处理。研究构建了包含多种校园场景的专业数据集,并采用数据增强技术提升模型性能。系统可检测人员、车辆和物品等目标,分析其行为轨迹,评估安全风险并触发告警。实验结果表明,该系统能有效识别校园安全隐患,为安全管理提供智能化解决方案。

一键难忘的博客 503

Codeforces Round 1023 (Div. 2)

【代码】Codeforces Round 1023 (Div. 2)

2201_75933169的博客 651

ShardingJDBC支持批量插入数据

最近在进行分库分表,但是有张表,里面有一些批量的插入。 也就是: insert xxx values(...),(...),(...) 这样的语句。 开始我的依赖是: <dependency> <groupId>io.shardingjdbc</groupId> <artifactId>sharding-jdbc-core</artifactId> <v

谙忆-陈浩翔 9766

Codeforces Round 1023 (Div. 2) (A-D)

每周至少五篇博客:(1/5)

Resot的博客 986

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

codeforces 1023 A. Single Wildcard Pattern Matching(字符串处理)

题目描述:http://codeforces.com/contest/1023/problem/A c++代码: #include &lt;iostream&gt; #include &lt;algorithm&gt; using namespace std; int main() { int n,m; string s,t; cin &gt;&gt; n &gt...

一只谜谜怪的博客 278

NTscan扫描工具

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

Codeforces Round 1023

Codeforces Round 1023

青少年趣味编程 656

深度学习工具包 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")

Codeforces 1023A Single Wildcard Pattern Matching

一个字符有一个通配符,另一个没有,判断两个字符是否相等。 情况一:字符一没有通配符,直接strcmp函数比较得结果 情况二:字符一有通配符,将字符一中的通配符删去,在字符二中截取相应的部分构成另一个字符在进行比较 #include<iostream> #include<cstring> #include<cstdio> using namespac...

傻子是小傲娇的博客(大钊) 323

Codeforces 1023A Single Wildcard Pattern Matching(瞎搞)

题目链接:Single Wildcard Pattern Matching 题意 给定两个字符串 sss 和 ttt,长度分别为 nnn 和 mmm,sss 串中最多含有一个 * 通配符,通配符可以用任意字符串(也可能为空)替换,问能否将其中的通配符用某个字符串替换后,使 sss 与 ttt 串相等。 输入 第一行为两个整数 n,m&nbsp;(1≤n,m≤2×105)n...

Dmaxiya 370

Codeforces 1023A - A. Single Wildcard Pattern Matching(思维)

A. Single Wildcard Pattern Matching time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given two strings ss and tt. The strin...

辞树 268

Codeforces Round #504 1023A - Single Wildcard Pattern Matching

题意:输入两个字符串,字符串里面可能有一个通配符,可以匹配任意小写英文字母,也可以匹配空字符,现在判断能不能把第一个字符串,改成第二个字符串。能YES,否则No。 写的好丑。。。 #include&lt;bits/stdc++.h&gt; #define maxn 300010 using namespace std; typedef long long ll; ll n,m,pos; c...

xx_ii 401

codeforces-1023 A Single Wildcard Pattern Matching

1 #include <iostream> 2 #include <unordered_map> 3 #include <algorithm> 4 #include <vector> 5 #include <queue> 6 7 using namespace std; 8 9 int main(...

weixin_30316097的博客 76

Codeforces Round #504 (Div. 1 + Div. 2) 1023A 1023B 1023C总结

A题卡了一个小时,真实。。。。 看了wa6,相同长度的字符串,坑在代码里面写了,凉凉难受。题目其实很清楚,就是从两头去比较是否相同。 #include&lt;stdio.h&gt; #include&lt;string.h&gt; int main() { int n, m; while (~scanf("%d %d", &amp;n, &amp;m)) { char s1[30...

Geek 328

Codeforces Round 1023 A~C

例如”()()“和”(())“是正则序列(转换后分别为”(1)+(1)“和”((1+1)+1)“),而”)(“、”(“和”)"则不是。=“aba*aba”,那么以下字符串与之匹配:“abaaba”、“abacaba” 和 “abazzzaba”,但以下字符串不匹配:“ababa”、“abcaaba”、“codeforces”、“aba1aba”、“aba?首先,如果不算上星号,字符串s的长度比字符串t的长度长,那么就一定不匹配(输出 “NO”)。,则打印 “YES”,否则打印 “NO”。

H_Caibird的博客 1028

Codeforces Round 1023 (Div.2)

Codeforces Round 1023 (Div.2)

djhws144的博客 909

Codeforces 1023 A.Single Wildcard Pattern Matching-匹配字符 (Codeforces Round #504 (rated, Div. 1 + Div....

Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final) A. Single Wildcard Pattern Matching 题意就是匹配字符的题目,打比赛的时候没有看到只有一个" * ",然后就写挫了,被hack了,被hack的点就是判一下只有一个" * "。 代码...

weixin_30700977的博客 153
上一篇: codeforces 1023D Array Restoration 线段树
下一篇: hdu 1402 A * B Problem Plus FFT模板
Dale_zero
博客等级 码龄9年 10粉丝 174原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值