PAT T1015 Letter-moving Gam
双下标法找最长公共子序列(不能删除字符)
#include<bits/stdc++.h>
using namespace std;
const int maxn=;
string s;
string t;
int main () {
cin>>s>>t;
int maxLength=;
int st,ed;
for (int i=;i<s.length();i++) {
st=i;
ed=;
while (st<s.length()&&ed<s.length()) {
if (s[ed]==t[st]) st++;
ed++;
}
maxLength=max(maxLength,st-i);
}
printf ("%d",s.length()-maxLength);
return ;
}
PAT T1015 Letter-moving Gam的更多相关文章
- PAT A1153 Decode Registration Card of PAT (25 分)——多种情况排序
A registration card number of PAT consists of 4 parts: the 1st letter represents the test level, nam ...
- PAT 1032 Sharing[hash][链表][一般上]
1032 Sharing (25)(25 分) To store English words, one method is to use linked lists and store a word l ...
- 1153 Decode Registration Card of PAT (25 分)
A registration card number of PAT consists of 4 parts: the 1st letter represents the test level, nam ...
- PAT_A1153#Decode Registration Card of PAT
Source: PAT A1153 Decode Registration Card of PAT (25 分) Description: A registration card number of ...
- PAT(B) 1057 数零壹(Java)字符串
题目链接:1057 数零壹 (20 point(s)) 题目描述 给定一串长度不超过 105 的字符串,本题要求你将其中所有英文字母的序号(字母 a-z 对应序号 1-26,不分大小写)相加,得 ...
- PAT Advanced 1153 Decode Registration Card of PAT (25 分)
A registration card number of PAT consists of 4 parts: the 1st letter represents the test level, nam ...
- PAT甲级【2019年3月考题】——A1157 Anniversary【25】
Zhejiang University is about to celebrate her 122th anniversary in 2019. To prepare for the celebrat ...
- PAT甲级——A1153 DecodeRegistrationCardofPAT【25】
A registration card number of PAT consists of 4 parts: the 1st letter represents the test level, nam ...
- PAT甲级——A1032 Sharing
To store English words, one method is to use linked lists and store a word letter by letter. To save ...
随机推荐
- Panda的学习之路(2)——pandas选择数据
首先定义panda dates=pd.date_range(',periods=6) # print(dates) df=pd.DataFrame(np.arange(24).reshape(6,4) ...
- electron-vue + element-ui构建桌面应用
最近需要用Node.js做一个桌面的应用,了解到electron可以用来做跨平台的桌面应用,而vue可以用来作为界面的解决方案,研究了一会儿如何把他们两个整合到一起使用,遇到了各种问题而放弃,毕竟作为 ...
- iOS 10.3+ 动态修改 App 图标
支持系统: iOS 10.3+ tvOS 10.2+ Apple 官方文档 官方 API: @interface UIApplication (UIAlternateApplicationIcons) ...
- .net core IIS 发布
发布时注意事项: 1.本机安装.net core SDK 2.启动项目预加载 3.应用池配置为 无托管代码 4.设置应用池-->高级设置-->启动模式为:AlwaysRunning 5.在 ...
- Java内存模型(JMM)那些事
本文是库存文章,去年年底学习了慕课网的并发编程课程,今年年初看完了<深入理解Java虚拟机>这本书,但是很多内容忘得差不多了,打算写写博客回忆一下那些忘在脑后的知识点. 温故而知新 更多J ...
- [Jenkins] TestComplete 使用Jenkins进行持续集成测试
1.安装正确的TestComplete插件 在Jenkins里面搜索TestComplete,找到正确的插件然后安装,可以重启jenkins或者选择不重启 在Install Tab 下面可以查看到正确 ...
- Abaqus 粘聚力模型(Cohesive Model)
目录 1. 问题描述 2. 有限元模型建立--Cohesive单元 3. 有限元模型建立--接触方法 Abaqus提供了两种方法模拟胶结特性: 使用Cohesive单元模拟胶结,通过定义材料属性和截面 ...
- 【Hibernate 多表查询】
HibernateManyTable public class HibernateManyTable { //演示hql左连接查询 @Test public void testSelect12() { ...
- python csv 数据切割定制jmeter数据
需求压测随机抽取10w数据中自定义区间的指定数量数据进行压测: jmeter csv/txt配置: 需要获取{data: [${myList}] } jmeter需要数据类型 获取展读取csv数据 ...
- 移除微信昵称中的emoji字符
移除微信昵称中的emoji字符: /** * 移除微信昵称中的emoji字符 * @param type $nickname * @return type */ function removeEmoj ...