为什么CE了啊???
  • 板块学术版
  • 楼主mzx的小娇妻
  • 当前回复15
  • 已保存回复15
  • 发布时间2020/7/28 15:16
  • 上次更新2023/11/6 21:58:37
查看原帖
为什么CE了啊???
349848
mzx的小娇妻楼主2020/7/28 15:16

如题

#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
void qazwsx()
{
	ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);
}
int f[100000][100000],n,m;
int main(){
	qazwsx();
	char x[100000],y[100000];
	scanf("%s%s",x+1,y+1);
	n=strlen(x+1);
	m=strlen(y+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++)
		{
		    if(x[i]==y[j])
		    {
		    	f[i][j]=f[i-1][j-1];
	    	}
	    	else
	    	{
	    		f[i][j]=min(min(f[i-1][j-1],f[i][j-1]),f[i-1][j])+1;
	    	}
		}
	}
	cout<<f[n][m];
	return 0;
}
2020/7/28 15:16
加载中...