6 条题解

  • 0
    @ 2022-1-24 11:57:24
    #include <math.h>
    #include <stack>
    #include <stdio.h>
    #include <iostream>
    #include <vector>
    #include <iomanip>
    #include <string.h>
    #include <algorithm>
    using namespace std;
    #define LL long long
    const int N = 1e5 + 10;
    const int INF = 0x3f3f3f3f;
    char a[100],b[100];
    int main()
    {
        cin >> a >> b;
        int lena, lenb;
        lena = strlen(a);
        lenb = strlen(b);
        int  maxx = 0;
        for(int i = 0; i < lena; i++)
        {
            for(int j = 0; j < lenb; j++)
            {
                int num = 0;
                while(j + num < lenb && a[i + num] == b[j + num])
                {
                    num++;
                }
                maxx = max(maxx,num);
            }
        }
        cout << maxx << endl;
        return 0;
    }```

    信息

    ID
    1120
    时间
    1000ms
    内存
    128MiB
    难度
    9
    标签
    递交数
    243
    已通过
    24
    上传者