当前位置:网站首页>[linear DP] shortest editing distance
[linear DP] shortest editing distance
2022-07-01 02:55:00 【Nathan Qian】
subject

explain
Code segment
#include<iostream>
using namespace std;
int n,m;
const int N=1010;
char a[N],b[N];
int f[N][N];
int main()
{
cin>>n>>a+1;
cin>>m>>b+1;
for(int i=1;i<=n;i++)f[i][0]=i;
for(int i=1;i<=m;i++)f[0][i]=i;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
{
f[i][j]=min(f[i-1][j]+1,f[i][j-1]+1);
if(a[i]==b[j])f[i][j]=min(f[i-1][j-1],f[i][j]);
f[i][j]=min(f[i-1][j-1]+1,f[i][j]);
}
cout<<f[n][m]<<endl;
}边栏推荐
- Youmeng (a good helper for real-time monitoring of software exceptions: crash) access tutorial (the easiest tutorial for Xiaobai with some foundation)
- 安装VCenter6.7【VCSA6.7(vCenter Server Appliance 6.7) 】
- [small program project development -- Jingdong Mall] the home page commodity floor of uni app
- Mouse over effect 9
- 鼠标悬停效果八
- 鼠标悬停效果七
- Restcloud ETl数据通过时间戳实现增量数据同步
- Gartner research: in China, the adoption of hybrid cloud has become the mainstream trend
- Dart training and sphygmomanometer inflation pump power control DPC
- How to determine the progress bar loaded in the loading interface when opening the game
猜你喜欢

The operation efficiency of the park is improved, and the application platform management of applet container technology is accelerated

【Qt】添加第三方库的知识补充

servlet【初识】

Cloud native annual technology inventory is released! Ride the wind and waves at the right time

安装VCenter6.7【VCSA6.7(vCenter Server Appliance 6.7) 】
![[machine learning] vectorized computing -- a must on the way of machine learning](/img/3f/d672bb254f845ea705b3a0ca10ee19.png)
[machine learning] vectorized computing -- a must on the way of machine learning

Prototype and prototype chain in JS

Proxy support and SNI routing of pulsar

RestCloud ETL WebService数据同步到本地

Restcloud ETL data realizes incremental data synchronization through timestamp
随机推荐
JS anti shake and throttling
股票开户安全吗?上海股票开户步骤。
旷世轻量化网络ShuffulNetV2学习笔记
【小程序项目开发 -- 京东商城】uni-app 商品分类页面(下)
使用ipmitool配置X86服务器的BMC网络和用户信息
Cluster method synchronous execution framework suona
Share Creators萌芽人才培养计划来了!
Catch 222222
Restcloud ETL practice to realize incremental data synchronization without identification bit
Xception learning notes
【小程序项目开发--京东商城】uni-app之自定义搜索组件(上)
Mouse over effect IV
股票开账户如何优惠开户?还有,在线开户安全么?
PCB defect detection based on OpenCV and image subtraction
In the industrial Internet, "small" programs have "big" effects
大橙子疯博客搬家通知
Mouse over effect 10
robots.txt限制搜索引擎收录
[PR # 5 A] two way running (state pressure DP)
[applet project development -- Jingdong Mall] user defined search component of uni app (Part 1)

