Description The repetition number of a string is defined as the maximum number R such that the string can be partitioned into R same consecutive substrings. For example, the repetition number of "ababab" is 3 and "ababa" is 1. Given a string containing lowercase letters, you are
后缀数组模板题,直接看注释就好了 #include<cstdio>
#include<cstring>
#include<algorithm>
#define LL long long
using namespace std;
const int maxn = 1e5 + 5;
char s[maxn]; LL ans;
int SA[maxn], SA2[maxn], RK[maxn], tot[maxn], H[maxn];
//SA : 第一关键字排名为i的开头下标
//SA2 : 第二关键字排名为i的开头下标
//RK : 原字符串中下标为i后缀的
Given a string, we need to find the total number of its distinct substrings. InputT- number of test cases. T<=20; Each test case consists of one string, whose length is <= 1000 OutputFor each test case output one number saying the number of distinct substrings. ExampleSample Input: 2 CCCCC ABA