BZOJ3098 Hash Killer II 【Probability】

A very interesting question
is a card \(hash\)

We first take L about a few dozen to ensure that the result will exceed \(10^9 + 7\)

Then randomly output \(10^5\) characters

From the prompt of the title, we can think that if we have the number of \(n\) and choose \(k\) times, then the expected number of repeated numbers is:
\[\sum\limits_{i = 0}^{k } \frac{i}{n}\]

We make
\[\sum\limits_{i = 0}^{k} \frac{i}{n} = 1\]
to solve \(k\) approximately equal to \(\sqrt{n}\)

It can be proved that randomly select \(\sqrt{n}\) numbers in the range of \(n \) , and expect to have at least one repeated number

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324907630&siteId=291194637