zoukankan      html  css  js  c++  java
  • HDU 2895 贪心 还是 大水题

    DESCRIPTION:大意是给你两个字符串。编辑距离只有add和delete会产生。所以。编辑距离最短一定是两个字符串的长度差。然后...呵呵呵呵.... 猜题意就可以了...但是...我觉得这个题很不专业...题面上给的是删除时不输出字符...raner...还是要输出...还有就是...如果恰好当前对应的两个位置刚好相同..还是要modify...逗我玩呢....

    总而言之。。已无力吐槽...

    附代码:

    #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;
    }

  • 相关阅读:
    ssh-keygen的使用方法(无密码访问)
    ubuntu solute two different terminals cmd
    ubuntu 查看系统是32位还是64位
    pyplot 绘图与可视化
    python 正则表达式的处理
    python&pandas 与mysql 连接
    Ubuntu 11.10 H3C iNode 客户端安装
    Vijos1055(极大子矩阵)
    Vijos1055(极大子矩阵)
    luoguP2701 [USACO5.3]巨大的牛棚Big Barn(极大子矩阵)
  • 原文地址:https://www.cnblogs.com/icode-girl/p/4671900.html
Copyright © 2011-2022 走看看