题目

Solution

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

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);
}