HDU 2895 greedy or a flood problem

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.