当前位置:网站首页>蓝桥杯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;
}
边栏推荐
- Reconstruction practice of complex C-end project of acquisition technology
- ROS2前置基础教程 | 使用CMakeLists.txt编译ROS2节点
- 剑指Offer46——把数字翻译成字符串
- 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
- 向量1(类和对象)
- Tdengine connector goes online Google Data Studio store
- 大会倒计时 | 亚马逊云科技创新大会邀您一起构建AI新引擎 !
- 【浙江大学】考研初试复试资料分享
- MongoDB在腾讯零售优码中的应用
- 晒晒我这两年的私活单,业余时间月入6k,有份副业也太香啦
猜你喜欢

After 100 days, Xiaoyu built a robot communication community!! Now invite moderators!

ML笔记-matrix fundamental, Gradient Descent

Reconstruction practice of complex C-end project of acquisition technology

Is the encryption market a "natural disaster" or a "man-made disaster" in the cold winter?

Runmaide medical passed the hearing: Ping An capital was a shareholder with a loss of 630million during the year

关于 GIN 的路由树

那些没考上大学的人,后来过的怎样

润迈德医疗通过聆讯:年内亏损6.3亿 平安资本是股东

FPGA collects DHT11 temperature and humidity

晒晒我这两年的私活单,业余时间月入6k,有份副业也太香啦
随机推荐
PHP内置协议(支持的协议和封装协议)
米哈游六月社招火热开启!500+岗位,超多HC,就在这个夏天(附内推方式)
Ultimate efficiency is the foundation for the cloud native database tdsql-c to settle down
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
What is the value of a website? Why build an independent station
百行代码实现基于Redis的可靠延迟队列
What happened to those who didn't go to college
历时100天、小鱼搭建了个机器人交流社区!!现公开邀请版主中!
FreeRTOS task priority and interrupt priority
How MySQL modifies the storage engine to InnoDB
Ml notes matrix fundamental, gradient descent
KEIL仿真和vspd
How to open an account in flush? Is online account opening safe?
ML笔记-matrix fundamental, Gradient Descent
“软件定义世界,开源共筑未来” 2022开放原子全球开源峰会7月底即将开启
[Zhejiang University] information sharing of the first and second postgraduate entrance examinations
鸿世电器冲刺创业板:年营收6亿 刘金贤股权曾被广德小贷冻结
类似attention nlp
Database connection pool: stress testing
How to use the concat() function of MySQL