803. Pseudorandom sequence

Rand48 is a pseudorandom number generator used by some programming languages. It generates a sequence from any given integer using the rule .

Let . The sequence is translated to an infinite string via the rule: a, b, , z, A, B, , Z.

For example, if we choose , then the string starts with: "bQYicNGCY". Moreover, starting from index , we encounter the substring "RxqLBfWzv" for the first time.

Alternatively, if starts with "EULERcats", then must be .

Now suppose that the string starts with "PuzzleOne". Find the starting index of the first occurrence of the substring "LuckyText" in .

803. 伪随机序列

某些编程语言会使用 Rand48 这种伪随机数生成器。给定整数 ,Rand48 通过 这个递推关系生成一个序列。

。我们通过如下规则将无限长数列 转换成无限长字符串 a, b, z, A, B, Z。

例如,我们取 ,则字符串 的前几位是 "bQYicNGCY"。在 下标为 100 的位置第一次出现子串 "RxqLBfWzv"。 同样,如果 的前几位是 "EULERcats",可以验证 只能是

现在,我们假设 以 "PuzzleOne" 开头,求: 中第一次出现子串 "LuckyText" 的起始位的下标。


这个链接 回到源站。

这个链接 回到详细版题目目录。