题目链接: http://acm.hust.edu.cn/vjudge/problem/113725 Repeated Substrings Time Limit: 3000MS 样例 sample input 3 aabaab aaaaa AaAaA sample output 5 4 5 题意 求出现过两次以上的不同子串有多少种. 题解 用后缀数组求出height[]数组,然后扫一遍,发现height[i]-height[i-1]>=0;就ans+=height[i]-height[i-1]…
评测地址:https://cn.vjudge.net/problem/CSU-1632 Description 求字符串中所有出现至少2次的子串个数 Input 第一行为一整数T(T<=10)表示用例组数,每组用例占一行为一个长度不超过100000的字符串 Output 对于每组用例,输出该串中所有出现至少两次的子串个数 Sample Input 3 aabaab aaaaa AaAaA Sample Output 5 4 5 Solution Ans=sum(max(height(i)-hei…
http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1305 1305: Substring Time Limit: 2 Sec  Memory Limit: 10 MB Submit: 12  Solved: 2 [Submit][Status][Web Board] Description Given a string s. The length of s is smaller than 1000. You are to caculate the…
题目链接:https://vjudge.net/problem/POJ-3415 Common Substrings Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 12240   Accepted: 4144 Description A substring of a string T is defined as: T(i, k)=TiTi+1...Ti+k-1, 1≤i≤i+k-1≤|T|. Given two stri…
题目链接:https://vjudge.net/problem/POJ-1226 Substrings Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 15122   Accepted: 5309 Description You are given a number of case-sensitive strings of alphabetic characters, find the largest string X,…
题目链接:https://vjudge.net/problem/SPOJ-SUBST1 SUBST1 - New Distinct Substrings #suffix-array-8 Given a string, we need to find the total number of its distinct substrings. Input T- number of test cases. T<=20; Each test case consists of one string, who…
Given a string, we need to find the total number of its distinct substrings. Input T- number of test cases. T<=20;Each test case consists of one string, whose length is <= 1000 Output For each test case output one number saying the number of distinc…
Given a string, we need to find the total number of its distinct substrings. Input T- number of test cases. T<=20;Each test case consists of one string, whose length is <= 1000 Output For each test case output one number saying the number of distinc…
后缀数组,看到网上很多题解都是单调栈,这里提供一个不是单调栈的做法, 首先将两个串 连接起来求height   求完之后按height值从大往小合并.  height值代表的是  sa[i]和sa[i-1] 的公共前缀长度,那么每次合并就是合并  i和i-1 那么在合并小的时候公共前缀更大的肯定已经都合并在一起,那么就可以直接统计了. #include<iostream> #include<cstdio> #include<algorithm> #include<…
Description You are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse can be found as a substring of any of the given strings. Input The first line of the input contains a…