您当前的位置: 首页 > 

*DDL_GzmBlog

暂无认证

  • 3浏览

    0关注

    605博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

[vj] 4821-String 字符串Hash

*DDL_GzmBlog 发布时间:2021-11-07 17:42:21 ,浏览量:3

前言

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            
关注
打赏
1657615554
查看更多评论
0.0986s