【poj 3461】 Oulipo 中文题意&题解&代码(C++)

【ACM- OJ】《Oulipo》C++ 【ACM- OJ】《Oulipo》C++题目描述输入输出样例输入样例输出AC代码 题目描述 The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter ‘e’. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tout s’affirmait f 阅读详情

**
Oulipo

**
Time Limit: 1000MS Memory Limit: 65536K

Description

The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter ‘e’. He was a member of the Oulipo group. A quote from the book:

Tout avait Pair normal, mais tout s’affirmait faux. Tout avait Fair normal, d’abord, puis surgissait l’inhumain, l’affolant. Il aurait voulu savoir où s’articulait l’association qui l’unissait au roman : stir son tapis, assaillant à tout instant son imagination, l’intuition d’un tabou, la vision d’un mal obscur, d’un quoi vacant, d’un non-dit : la vision, l’avision d’un oubli commandant tout, où s’abolissait la raison : tout avait l’air normal mais…

Perec would probably have scored high (or rather, low) in the following contest. People are asked to write a perhaps even meaningful text on some subject with as few occurrences of a given “word” as possible. Our task is to provide the jury with a program that counts these occurrences, in order to obtain a ranking of the competitors. These competitors often write very long texts with nonsense meaning; a sequence of 500,000 consecutive ‘T’s is not unusual. And they never use spaces.

So we want to quickly find out how often a word, i.e., a given string, occurs in a text. More formally: given the alphabet {‘A’, ‘B’, ‘C’, …, ‘Z’} and two finite strings over that alphabet, a word W and a text T, count the number of occurrences of W in T. All the consecutive characters of W must exactly match consecutive characters of T. Occurrences may overlap.

Input

The first line of the input file contains a single number: the number of test cases to follow. Each test case has the following format:

One line with the word W, a string over {‘A’, ‘B’, ‘C’, …, ‘Z’}, with 1 ≤ |W| ≤ 10,000 (here |W| denotes the length of the string W).
One line with the text T, a string over {‘A’, ‘B’, ‘C’, …, ‘Z’}, with |W| ≤ |T| ≤ 1,000,000.
Output

For every test case in the input file, the output should contain a single number, on a single line: the number of occurrences of the word W in the text T.

Sample Input

3
BAPC
BAPC
AZA
AZAZAZA
VERDI
AVERDXIVYERDIAN

Sample Output

1
3
0

中文题意:
简单说,就是给你n组数据,每组数据中包含两个字符串s和t,找出字符串s在字符串t中出现的次数,例:ababa中字符串aba出现2次,输出2。

很简单而明显的kmp,这里给出kmp模板,有基础的同学可以自己理解,没有基础的童鞋叶可以直接背代码。博主认为本人的模板还是杠杠的!

但是无论怎样都要记住nex数组的性质,nex[i]=j代表字符串中[0…i]和[j-i…i]是相同的!!!!!!!!!!!题目主要是用nex的数组变形解题的

模板如下:

inline void get_nex()
{
        int j=-1;
        for (int i=0;i<tlen;i++)
        {
                while  (t[i]!=t[j+1] && j!=-1)      j=nex[j];
                if (t[i]==t[j+1] && i!=0) j++;
                nex[i]=j;
        }
}
inline void kmp()
{
        int j=-1;
        for (int i=0;i<slen;i++)
        {
                while  (s[i]!=t[j+1] && j!=-1) j=nex[j];
                if (s[i]==t[j+1])     j++;
                if (j==tlen-1)  ans++,j=nex[j];
        }
}

用的时候按顺序用这两个函数就求出nex数组了,ans是长串中短串出现的次数
注意nex数组的大小和那个短串相同

本题的代码如下:

#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
char s[1000005],t[200000];
int slen,tlen;
int nex[200000];//nex数组大小和短串一致
int ans,a,b,c,d,n,m;
inline void get_nex()
{
        int j=-1;
        for (int i=0;i<tlen;i++)
        {
                while  (t[i]!=t[j+1] && j!=-1)      j=nex[j];
                if (t[i]==t[j+1] && i!=0) j++;
                nex[i]=j;
        }
}
inline void kmp()
{
        int j=-1;
        for (int i=0;i<slen;i++)
        {
                while  (s[i]!=t[j+1] && j!=-1) j=nex[j];
                if (s[i]==t[j+1])     j++;
                if (j==tlen-1)  ans++,j=nex[j];
        }
}
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++)
    {
        ans=0;
        scanf("%s %s",t,s);
        slen=strlen(s);
        tlen=strlen(t);//这两个长度应该设为全局变量最开始时求出,不能用一次求一次
        get_nex();
        kmp();
        printf("%d\n",ans);
    }
}
【POJ 3461】Oulipo 中文题意&题解&代码(C++) kmp模板水体 阅读详情

相关推荐

别光看Demo了!用UE5 Lyra框架快速搭建你的多人对战游戏原型(含完整配置流程)

本文详细介绍了如何利用UE5 Lyra框架快速搭建多人对战游戏原型,包含完整的配置流程和实战案例。Lyra作为可直接二次开发的游戏模板,内置了GAS技能系统、Enhanced Input输入控制等核心功能,大幅缩短开发周期。通过替换角色模型、调整武器数值和配置新地图规则,开发者可在48小时内完成科幻团队竞技游戏原型的搭建。

weixin_28717411的博客 470

1455 Oulipo

1455 Oulipo 给定两个字符串,求第一个字符串在第二个字符串中出现了几次,这不就是KMP?(为什么我总觉得是KMP,可能是我喜欢吃烤馍片吧) 其实hash还是挺简单的,就是一个模板的题 #include&lt;bits/stdc++.h&gt; using namespace std; typedef long long ll; const int SIZE=1e4+5; char a[SIZE],b[SIZE]; int p[SIZE]; int hash[SIZE]; int base=27,m

CCCCDEV_CCCC的博客 356

龙头战法本质:流动性、情绪与资金共识的行为模型

龙头战法并非玄学或涨停投机,而是基于市场微观结构的可验证行为模型。其核心在于理解股票在特定阶段所呈现的流动性分布、情绪周期位置及资金共识演化路径——这三者共同构成‘强度-位置-量能’三维校验体系。从技术视角看,它融合了行为金融学原理与实盘资金痕迹识别,强调对分歧买点、梯队生态、筹码结构等关键信号的量化解码。该模型广泛应用于A股题材主线交易、短线强度排序、退潮期风险识别等实战场景,尤其适配游资主导、板块轮动频繁的中小市值活跃市场。文中重点拆解的‘行为指纹’‘动态强度表’‘生命周期刻度’等概念,正是将抽象心法转

weixin_29758911的博客 284

信息学奥赛一本通 1455:【例题1】Oulipo

数据范围比较大,直接枚举会爆掉,需要字符串哈希,哈希值相同则两个字符串相同。这里只要开一个h就行,s1的哈希值用一个变量递推就可以。

pystraf的博客 1129

基于bootstrap+Java的图书管理系统(任务书)

10] 倪甜弟,周晓波,王相喜.基于JSP图书馆自习室预约系统的设计与实现[J].现代计算机, 2024, 30(9):117-120.DOI:10.3969/j.issn.1007-1423.2024.09.023.[2] 陈明雪,赵勇,周小丽,等.基于Node.js和Bootstrap的图书管理系统设计与研究[J].现代信息科技, 2021, 5(24):4.[9] 杨婷婷.基于VOSviewer的图书馆管理系统研究的可视化分析[J].现代信息科技, 2023, 7(3):123-126.

毕业作品网站 654

手把手教你用THS4551搭建全差分放大器电路(附ADC驱动实战)

本文详细介绍了如何使用TI的THS4551全差分放大器搭建高性能ADC驱动电路,涵盖芯片选型、电路配置、PCB布局及实战调试等关键环节。THS4551凭借其优异的共模抑制比和宽电源电压范围,成为驱动16位及以上精度ADC的理想选择,特别适合工业应用场景。

weixin_30338481的博客 302

C++——KMP算法例题——Oulipo(POJ3461)

Oulipo Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 38073   Accepted: 15327 Description The French author Georges Perec (1936–1982) once wrote a book, La

McDonnell_Douglas的博客 856

详解AUTOSAR:AUTOSAR架构中的配置文件(拓展篇—7)

查看AUTOSAR代码包时会发现一些这样格式的文件:xxx_PBcfg.c、xxx_Lcfg.c和xxx_Cfg.h,本篇博文讲一讲这几个配置文件的作用和特点。

不脱发的程序猿 2153

kmp(Oulipo例题)理解

kmp(Oulipo例题)理解

m0_73843712的博客 127

使用Open3D进行RGB-D图像点云处理

在本文中,我们将使用Open3D来处理RGB-D图像,提取点云并进行一些基本的操作。总结起来,本文介绍了如何使用Open3D库处理RGB-D图像并提取点云。我们展示了如何读取RGB-D图像,创建RGB-D图像和点云,并显示点云。除了显示点云,Open3D还提供了许多其他功能,如点云滤波、点云配准、表面重建等。在创建RGB-D图像时,我们需要指定深度图像的缩放因子和截断值,以及是否将RGB图像转换为强度图像。希望本文能够帮助您入门Open3D,并在处理RGB-D图像和点云数据时提供一些指导。

QfcaLinux的博客 453

odom反算成经纬度

这个转换系统能够将局部坐标(相对于原点的X, Y, Z坐标)转换回全球坐标系统。将局部里程计数据反算成经纬度坐标的过程涉及几个关键步骤,主要是将相对于某个局部参考点的坐标(例如在机器人、无人车或无人机的导航系统中使用的坐标)转换回全球GPS坐标系统(WGS-84经纬度)。为了能够将局部里程计数据转换为经纬度,首先需要知道局部坐标系统的原点(即参考点)在全球坐标系统中的位置。对于从里程计获得的每个局部坐标点,使用步骤2中设置的坐标转换系统将其转换为经纬度。使用转换模型将局部坐标转换为全球坐标。

如果想成为中心,那么就到中心去吧。 654

【例题1】Oulipo(信息学奥赛一本通- P1455)

写哈希题,老老实实开个数组打表算次幂,远离一切浮点函数保平安。

布心老混子 所有代码均老混子本人远古手搓 易错点均为学生真实场景 博客文章部分借助ai生成 410

【unity游戏开发之InputSystem——01】通过写代码监听InputSystem输入(基于unity6开发介绍)

通过写代码监听InputSystem输入(基于unity6开发介绍)

向宇的博客,专注php/web全栈 unity游戏开发,欢迎大家评论纠错 4903

Oulipo(欧力波)(经典kmp模板题) HDU-1686

题目:Oulipo(欧力波)中文大意 The French author Georges Perec (1936�C1982) once wrote a book, La disparition, without the letter ‘e’. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tout s’affirmait faux. Tout avait Fair norma

R_711的博客 915

深度学习工具包 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&#39;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 = &quot;R. B. Palm&quot;, title = &quot;Prediction as a candidate for learning deep hierarchical models of data&quot;, year = &quot;2012&quot;,}```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(&#39;DeepLearnToolbox&#39;));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(&#39;state&#39;,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&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,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 = &#39;sigm&#39;;%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 &lt; 0.10, &#39;Too big error&#39;);```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(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;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)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;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 &lt; 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% 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&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 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&lt;0.12, &#39;Too big error&#39;);```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(&#39;state&#39;,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 &lt; 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,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 &lt; 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,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 &lt; 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % 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 &lt; 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % 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 &lt; 0.1, &#39;Too big error&#39;);%% 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(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % 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 &lt; 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free &quot;Bitdeli Badge&quot;)

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

Oulipo (KMP)

Oulipo 题目链接 The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter ‘e’. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tout s’affirmait faux. Tout avait Fair normal, d’abo

weixin_47701814的博客 535

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

Oulipo-欧力波(KMP字符串匹配问题)

Oulipo-欧力波 HDU - 1686 The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tout s’affirmait faux. Tout avait Fair..

m0_58245389的博客 325

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

Oulipo(哈希)

The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter ‘e’. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tout s’a...

Ray.C.L的博客 629

POJ3461 && LOJ#10033 Oulipo(字符串HASH)

题目链接 Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter'e'. He was a member of the Oulipo group. A quote from the book: Tout avait Pair ...

悲伤无声地涌出来 396

poj 3461 (看毛片算法初探)

Oulipo Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu SubmitStatusPracticePOJ 3461 Appoint description: Description The French author Georges Perec (1936–1982) once wr

fenghoumilin的博客 3万+

Oulipo

题目描述: The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter ‘e’. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais to...

博客 313

Oulipo(KMP)

Problem Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter ‘e’. He was a member of the Oulipo group. A quote from the book: Tout avait Pair n...

计算机科学与技术专业学生的成长之路 553

POJ 3461 Oulipo(乌力波)

POJ 3461 Oulipo(乌力波) Time Limit: 1000MS Memory Limit: 65536K 【Description】 【题目描述】 The French author Georges Perec (1936–1982) once wrote a book, La disparition, without ...

275

Oulipo 哈希

求模式串在待匹配串的出现次数。 Input 第一行是一个数字T,表明测试数据组数。 之后每组数据都有两行:第一行为模式串,长度不大于10000;第二行为待匹配串,长度不大于1000000。所有字符串只由大写字母组成。 Output 每组数据输出一行结果。 Sample Input 4 ABCD ABCD ABA ABABABA CDCDCDC CDC KMP NAIVE S...

liuliu2333的博客 532

1455:【例题1】Oulipo——字符串哈希

【题目描述】给出两个字符串s1,s2((只有大写字母),求s1在s2中出现多少次。例如:s1=“ABA”,s2=“ABAABA”,答案为2。【输入】输入T组数据,每组数据输出结果。【输出】如题述。【输入样例】3BAPCBAPCAZAAZAAZAAZAVEEDI【输出样例】130【提示】1≤s1的长度 ≤10^4​​ ,1≤s2的长度 ≤10^6​。

与其邻渊羡渔,不如退而结网 1250
上一篇: 【hdu】1698 just a hook 中文题意&题解
下一篇: C++ 组合数求法(小范围)
WilliamCode
博客等级 码龄11年 118粉丝 105原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值