• LQDOJ
  • Trang chủ
  • Bài tập
  • Bài nộp
  • Thành viên
  • Kỳ thi
  • Nhóm
  • Giới thiệu
    • Máy chấm
    • Khóa học
    • Đề xuất ý tưởng
    • Đề xuất bài tập
    • Tools
    • Báo cáo tiêu cực
    • Báo cáo lỗi

Tiếng Việt

Tiếng Việt
English

Đăng nhập

Đăng ký

nint4528

  • Giới thiệu
  • Bài tập
  • Bài nộp

Rating
-
Bài tập
0
Điểm
0
Rating #
-
Điểm #
31839

Giới thiệu

include <bits/stdc++.h>

define N 10000

define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

define form tungninh:))))

using namespace std;
string X, Y;
int dp[N+3][N+3];
int m, n;
int main()
{
fast;
freopen("CAU1.INP","r",stdin);
freopen("CAU1.OUT","w",stdout);
cin >> X >> Y;
m = X.size();
n = Y.size();
X = " "+X;
Y = " "+Y;
for(int i=1;i<=m;i++)
for(int j=1;j<=n;j++)
{
if(i==0||j==0)
dp[i][j]=0;
if(X[i] == Y[j])
dp[i][j]=dp[i-1][j-1];
else
dp[i][j]= min(dp[i-1][j],min(dp[i][j-1],dp[i-1][j-1]))+1;
}
cout << dp[m][n] << endl;
return 0;
}


«    »
Thứ 2
Thứ 3
Thứ 4
Thứ 5
Thứ 6
Thứ 7
CN
Ít
Nhiều

proudly powered by DMOJ| developed by LQDJudge team