Hash字符串写起了很简单
第一题
第二题
UVA11475
题意: 让你在字符串后面加字符,使它成为最短的回文串
**题解:**可以后缀数组,马拉车,扩展kmp,然后想说的就是这个hash做法很好写,你分别从前往后,和从后往前hash这个串,然后每次你去判断下,如果相等,说明从str[i…len]的位置就是回文串,不然hash值怎么会相等,(排除这个hash值冲突情况),最后要求的是最短的回文串…
AC代码
#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
template<typename T>
in