前言
md多组输入 传送门 :
思路题目意思找 长度为 M ∗ L M*L M∗L中 所有长度为 L L L的子串互不相同的字符串数量
因此我们直接使用Hash然后枚举就行了
CODE// Problem: String
// Contest: HDOJ
// URL: http://acm.hdu.edu.cn/showproblem.php?pid=4821
// Memory Limit: 32 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
// Problem: P2738 [USACO4.1]���ʻ�·Fence Loops
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P2738
// Memory Limit: 125 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include
using namespace std;
#define int long long
#define ll long long
#define endl '\n'
#define px first
#define py second
#define pb push_back
typedef pair pii;
int dxy[4][2] = {{-1,0},{0,1},{1,0},{0,-1}};
const int N = 1e5+10;
struct union_find_set{
int n,p[N];
void init(int N)
{
n = N;
for(int i=1;i>l)
{
SH.init(m*l);
cin>>s;
s = " "+s;
int len = s.size();
len --;
SH.hash(s,len);
ll res = 0 ;
for(int i = 1;i
关注
打赏