随笔分类 -  字符串-哈希

摘要:题面:https://www.luogu.org/problem/P3501 cpp 本题直接hash+暴力,二分对称中心即可. 或者是manacher,通过观察反对称串长度一定是偶数,并且反对称串中相匹配的字符位置必定一奇一偶,所以直接把奇数位取反,偶数为不动,然后就变成了回文串问题. (自然溢出 阅读全文
posted @ 2019-10-11 18:45 prestige 阅读(187) 评论(0) 推荐(0)
摘要:题面:https://www.luogu.org/problem/P4421 cpp 本题把所有可能的子串全部做一遍字符串哈希,然后判断一波即可. Code: include include include include include include include include using 阅读全文
posted @ 2019-10-10 20:20 prestige 阅读(165) 评论(0) 推荐(0)
摘要:题面:https://www.luogu.org/problem/P5018 cpp 本题直接写一个树上hash水过。。。 Code: include include include include include include include include include define ull 阅读全文
posted @ 2019-10-10 18:24 prestige 阅读(102) 评论(0) 推荐(0)
摘要:```cpp include include include include include include define ull unsigned long long using namespace std; ull base=131,a[10005],mod=212370440130137957 阅读全文
posted @ 2019-10-10 13:15 prestige 阅读(165) 评论(0) 推荐(0)