字符串——BZOJ3098: Hash Killer II(构造)

BZOJ3098: Hash Killer II(构造)

链接: lhttps://www.lydsy.com/JudgeOnline/problem.php?id=3098
题意:构造一个可以卡掉mod = 1e9+7,base随意的hash,数据n l str,使长度为n的str中的长度为l的两个以上的字串起hash冲突
根据生日悖论,xjb构造

#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1e5 + 10;

int main() {
    int N = 1e5, l = 25;
    printf("%d %d\n", N, l);
    for(int i = 1; i <= N; i++)
        printf("%c", 'a' + rand() % 26);
    return 0;
}

发布了23 篇原创文章 · 获赞 6 · 访问量 832

猜你喜欢

转载自blog.csdn.net/wxy2635618879/article/details/103964037