标签:mes pid min define http 距离 efi int etc
Code:
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
//Mystery_Sky
//
#define INF 0x3f3f3f3f
#define M 3000
int f[M][M];
int len_a, len_b;
char a[M], b[M];
int main() {
scanf("%s", a);
getchar();
scanf("%s", b);
len_a = strlen(a);
len_b = strlen(b);
for(int i = 1; i <= len_a; i++) f[i][0] = i;
for(int i = 1; i <= len_b; i++) f[0][i] = i;
for(int i = 1; i <= len_a; i++) {
for(int j = 1; j <= len_b; j++) {
if(a[i-1] == b[j-1]) {
f[i][j] = f[i-1][j-1];
}
else f[i][j] = min(min(f[i-1][j], f[i][j-1]), f[i-1][j-1]) + 1;
}
}
printf("%d\n", f[len_a][len_b]);
return 0;
}
标签:mes pid min define http 距离 efi int etc
原文地址:https://www.cnblogs.com/Benjamin-cpp/p/11025377.html