bzoj3098: Hash Killer II

题目

Solution

当模数为M,存在至少一个冲突的概率为p,有n个hash值
则总共有 C n 2 C_n^2 对hash值, p = ( M 1 M ) C n 2 p=(\frac{M-1}M)^{C_n^2}

Code

#include<cstdio>
#include<ctime>
#include<algorithm>
int main(){
	srand(time(0));
	puts("100000 20");
	for (int i=0;i<100000;i++) putchar(rand()%26+97);
}

猜你喜欢

转载自blog.csdn.net/xumingyang0/article/details/85059774