摘要: 原题链接 题解 1.把字符串倒过来,记作 \(S_1\) 其最大公共子串是回文串,所以这部分可以不用求,字符串长度减去最大公共子串的长度就是答案 2.怎么求最大公共子串的长度呢? 假设我们已经知道字符串a和字符串b及其所有子串的lbs,此时往字符串b末尾添加一个字符c变成字符串b1,而字符串a中以最 阅读全文
posted @ 2024-05-08 17:08 纯粹的 阅读(164) 评论(0) 推荐(0)
摘要: 原题链接 题解 细节很多,看代码 code #include<bits/stdc++.h> using namespace std; string s; int num; int vis[55][100005]={0}; int ans[55][100005]={0}; int sou(int po 阅读全文
posted @ 2024-05-08 13:21 纯粹的 阅读(39) 评论(0) 推荐(0)
摘要: 原题链接 题解 分解n的质因子,如果为奇数就补一个 由于大于 \(\sqrt{n}\) 的质因子最多不超过一个,所以我们筛小于 \(1e6\) 的质数 code #include<bits/stdc++.h> #define ll long long using namespace std; vec 阅读全文
posted @ 2024-05-08 12:03 纯粹的 阅读(47) 评论(0) 推荐(0)