当前位置:网站首页>[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;
}边栏推荐
- RestCloud ETL WebService数据同步到本地
- import tensorflow. contrib. Slim as slim error
- STM32 - DS18B20 temperature sampling of first-line protocol
- PHP batch Excel to word
- LeetCode_ Stack_ Difficulties_ 227. basic calculator (excluding multiplication and division)
- Classic programming problem: finding the number of daffodils
- Huawei operator level router configuration example | BGP VPLS configuration example
- Communication protocol -- Classification and characteristics Introduction
- How to open a stock account? Also, is it safe to open an account online?
- Sampling Area Lights
猜你喜欢

Introduction to kubernetes resource objects and common commands (II)

UE4渲染管线学习笔记

Huawei operator level router configuration example | configuration static VPLS example

VMware vSphere 6.7虚拟化云管理之12、VCSA6.7更新vCenter Server许可

Detailed data governance knowledge system

咱就是说 随便整几千个表情包为我所用一下

Mnasnet learning notes
![[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

Multithreaded printing

The operation efficiency of the park is improved, and the application platform management of applet container technology is accelerated
随机推荐
RestCloud ETL实践之无标识位实现增量数据同步
A shooting training method based on the digital measurement of Joule energy and posture of sphygmomanometer air bag with standard air pressure
Restcloud ETL data realizes incremental data synchronization through timestamp
Ipmitool download address and possible problems during compilation and installation
xxl-job使用指南
【EXSI】主机间传输文件
大橙子疯博客搬家通知
Pychar open remote directory remote host
Huawei operator level router configuration example | BGP VPLS and LDP VPLS interworking example
Classic programming problem: finding the number of daffodils
Mouse over effect I
AI edge computing platform - beaglebone AI 64 introduction
【小程序项目开发-- 京东商城】uni-app之首页商品楼层
ipmitool下载地址和编译安装时可能出现的问题
旷世轻量化网络ShuffulNetV2学习笔记
如果我在北京,到哪里开户比较好?另外,手机开户安全么?
Voici le programme de formation des talents de SHARE Creators!
一文讲解发布者订阅者模式与观察者模式
Network address translation (NAT) technology
Evaluation of the entry-level models of 5 mainstream smart speakers: apple, Xiaomi, Huawei, tmall, Xiaodu, who is better?

