思路 这里我们要注意以下几点: 字符串哈希自然溢出(\(\pmod 2^64\))会被卡,会\(WA~5\)个点 注意有模数的时候不要用\(unsigned\ long \ long\)类型 代码 #include <iostream> using namespace std; typedef long long LL; const int N = 2000010,BASE = 131,MOD = 998244353; int n; char s[N]; LL p[N],h1[N],h2[N]…
Description A palindrome is a string of symbols that is equal to itself when reversed. Given an input string, not necessarily a palindrome, compute the number of swaps necessary to transform the string into a palindrome. By swap we mean reversing the…