QOJ.ac

QOJ

実行時間制限: 3.0 s メモリ制限: 256 MB 満点: 100 ハック可能 ✓

#7225. 闪闪发光的循环

統計

你那身为数学天才的虚拟女友(这就是为什么她年纪轻轻却在你的大学读书)告诉你,她最近正在研究以下函数:

$$f_n(x) = \sum_{i=1}^{n} (x \bmod i)$$

其中 $n$ 是一个固定的正整数。

你很快意识到,这个函数实际上定义了一个图,其中所有的整数都是顶点,并且对于每个 $x$,都有一条从 $x$ 到 $f_n(x)$ 的有向边。

你的虚拟女友似乎对这种图中的环很感兴趣,她将其称为 kira cycle

为了讨好你的虚拟女友,你决定找出 kirakira cycle 的长度,即该图中最大的环的长度。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 10^4$),即上述的常数。

输出格式

输出一个整数 $l$,表示 kirakira cycle 的长度。

样例

样例输入 1

2

样例输出 1

1

样例输入 2

10

样例输出 2

4

样例输入 3

43

样例输出 3

7

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.