zoukankan      html  css  js  c++  java
  • 子串数据ZOJ 1642 Match for Bonus

    新手发帖,很多方面都是刚入门,有错误的地方请大家见谅,欢迎批评指正

        最长共公子串题问懂得的话。这个就不是题问了。水……

        zoj这类目题很多多少,都没有说数据范围……只能拼rp。。。。

        

        每日一道理
    风,渐渐吹起,吹乱了我的发丝,也让我的长裙有些飘动。绿叶仿佛在风中起舞,离开了树,投向了大地,却不知这样会枯萎,我弯下腰,轻轻拾起一片树叶,那非常有序的茎脉,是一种美的点缀。我有些哀叹:绿叶啊,绿叶,你这般美丽地从树上轻轻飘下,随风起舞,却不知已被人称之为落叶!
    #include <cstdio>
    #include <cstring>
    #include <algorithm>
    using namespace std;
    #define N 4050
    int a[300];
    int f[N][N], n, m;
    char s1[N], s2[N];
    
    int main() {
    
        int t, v;
        char ch;
        while (scanf("%d", &t) == 1) {
            while (t--) {
                scanf(" %c %d", &ch, &v);
                a[(int)ch] = v;
            }
            scanf(" %s %s", s1, s2);
            n = strlen(s1);
            m = strlen(s2);
    
            memset(f, 0, sizeof(f));
            for (int i=1; i<=n; i++)
                for (int j=1; j<=m; j++) {
                    if (s1[i-1] == s2[j-1]) f[i][j] = f[i-1][j-1] + a[(int)s1[i-1]];
                    f[i][j] = max(f[i][j], max(f[i-1][j], f[i][j-1]));
                }
            printf("%d\n", f[n][m]);
        }
    
        return 0;
    }

        

    文章结束给大家分享下程序员的一些笑话语录: 某程序员对书法十分感兴趣,退休后决定在这方面有所建树。花重金购买了上等的文房四宝。一日突生雅兴,一番磨墨拟纸,并点上了上好的檀香,颇有王羲之风 范,又具颜真卿气势,定神片刻,泼墨挥毫,郑重地写下一行字:hello world.

  • 相关阅读:
    Live2D 看板娘
    Live2D 看板娘
    Live2D 看板娘
    Live2D 看板娘
    Live2D 看板娘
    Live2D 看板娘
    Live2D 看板娘
    Live2D 看板娘
    Bound mismatch: The typae CertificateDirectory is not a valid substitute for the bounded parameter <M extends Serializable>
    Duplicate property mapping of contactPhone found in
  • 原文地址:https://www.cnblogs.com/xinyuyuanm/p/3061667.html
Copyright © 2011-2022 走看看