思路
我运用基于哈希值的LCP算法解决了这道题。
这两种方法请参考《算法竞赛入门经典——训练指南(算法艺术与信息学竞赛)》3.4字符串(2)。
写这道题过程中也参考了以下两篇博文:
PAT (Top Level) Practise 1005 Programming Pattern (35)
1005. Programming Pattern (35)【待解决】
通过画面
代码
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;
const int maxn &#