当前位置:网站首页>蓝桥杯2019年国赛最长子序列
蓝桥杯2019年国赛最长子序列
2022-06-22 14:25:00 【Stephen_Curry___】
题目链接:
链接: 最长子序列.
思路
一看到求最长子序列即可想到用双指针算法来求解,题目很简单,模拟一下就可以了。
C++代码
#include<bits/stdc++.h>
using namespace std;
int main(){
string s1, s2;
cin >> s1 >> s2;
int len = 0;
for(int i = 0, j = 0; i < s1.size(); i++){
if(s1[i] == s2[j]){
j++;
len++;
}
}
cout << len;
return 0;
}
边栏推荐
- All famous network platforms in the world
- 封装api时候token的处理
- Go all out to implement the flood control and disaster relief measures in detail and in place, and resolutely protect the safety of people's lives and property
- 向量3(静态成员)
- flutter video_ Player monitors and automatically plays the next song
- Flutter video Le lecteur écoute et joue automatiquement la prochaine chanson
- 时隔17年,刘亦菲再次刷屏式爆红:普通人不想被淘汰,也要懂得这件事
- Follow up to the "June 21" gas explosion accident in Tai'an, Shandong Province: comprehensive investigation and remediation of potential gas safety hazards in restaurants
- Runmaide medical passed the hearing: Ping An capital was a shareholder with a loss of 630million during the year
- 专业“搬砖”老司机总结的 12 条 SQL 优化方案,非常实用!
猜你喜欢

New hybrid architecture iformer! Flexible migration of convolution and maximum pooling to transformer

英国考虑基于国家安全因素让Arm在伦敦上市
![[Zhejiang University] information sharing of the first and second postgraduate entrance examinations](/img/15/298ea6f7367741e1e085007c498e51.jpg)
[Zhejiang University] information sharing of the first and second postgraduate entrance examinations

ROS2前置基础教程 | 小鱼教你用CMake依赖查找流程

历时100天、小鱼搭建了个机器人交流社区!!现公开邀请版主中!

Please, don't be brainwashed. This is the living reality of 90% of Chinese people

晒晒我这两年的私活单,业余时间月入6k,有份副业也太香啦

ROS2前置基础教程 | 使用CMakeLists.txt编译ROS2节点

Once, I had 5 part-time jobs just to buy a new earring for my girlfriend

得物App数据模拟平台的探索和实践
随机推荐
【浙江大学】考研初试复试资料分享
天安科技IPO被终止:曾拟募资3.5亿 复星与九鼎是股东
What are the five characteristics of network security? What are the five attributes?
KEIL仿真和vspd
向量3(静态成员)
SDVO:LDSO+语义,直接法语义SLAM(RAL 2022)
U++ iterative Sorting Query learning notes
I took a private job and earned 15250. Is it still necessary to do my main business?
社区文章|MOSN 构建 Subset 优化思路分享
flutter video_ Player monitors and automatically plays the next song
ML笔记-matrix fundamental, Gradient Descent
关于 GIN 的路由树
Found several packages [runtime, main] in ‘/usr/local/Cellar/go/1.18/libexec/src/runtime;
好风凭借力 – 使用Babelfish 加速迁移 SQL Server 的代码转换实践
"Forget to learn again" shell process control - 38. Introduction to while loop and until loop
What does Alibaba cloud's cipu release mean for enterprise customers?
剑指Offer46——把数字翻译成字符串
又可以这样搞nlp(分类)
OOP 多重收纳(类模板)
FreeRTOS task priority and interrupt priority