DESCRIPTION: The effect is to give you two strings. Edit distance only add and delete will be generated. So. The minimum editing distance must be a length difference of two strings. And then... Oh oh ..... Guess test instructions can do it ... But... I think this problem is very unprofessional ... On the surface is the deletion of the output characters ... raner ... or to output ... And there is ... If exactly the current corresponding two locations are exactly the same: Still want to modify ... Tease me ....
Word.. have been unable to spit the groove ...
Attached code:
#include <stdio.h>
#include <string.h>
#include <iostream>
using namespace Std;
Char s1[10010], s2[10010];
int main ()
{
while (scanf ("%s%s", S1, s2)! = EOF)
{
int len1 = strlen (S1);
int len2 = strlen (s2);
if (Len1 < len2)
{
for (int i=0; i<len2-len1; ++i)
{
cout << "A" << s2[i] << Endl;
}
for (int i=len2-len1; i<len2; ++i)
{
cout << "M" << S2[i] << Endl;
}
}
else if (len1 = = len2)
{
for (int i=0; i<len2; ++i)
{
cout << "M" << S2[i] << Endl;
}
}
else if (Len1 > Len2)
{
for (int i=0; i<len1-len2; ++i)
for (int i=len1-len)
{
cout << "D" << S1[i] << Endl;
}
for (int i=0; i<len2; ++i)
{
cout << "M" << S2[i] << Endl;
}
}
}
return 0;
}
HDU 2895 greedy or a flood problem