QOJ.ac

QOJ

Límite de tiempo: 5 s Límite de memoria: 1024 MB Puntuación total: 100

#4634. 因子

Estadísticas

设 $\mathbb{F}_x$ 为整数 $x$ 的所有因数构成的集合(回想一下,若正整数 $f$ 能整除 $x$,则称 $f$ 为 $x$ 的因数)。如果对于所有 $1 \le y \le x$,都存在 $\mathbb{F}_x$ 的一个子集,使得该子集中所有元素之和等于 $y$,则称 $x$ 为“好整数”。

例如,$6$ 是好整数,因为 $\mathbb{F}_6 = \{1, 2, 3, 6\}$,且 $4 = 1 + 3$,$5 = 2 + 3$。$5$ 不是好整数,因为 $\mathbb{F}_5 = \{1, 5\}$,我们无法找到一个子集使得元素之和为 $2$、$3$ 或 $4$。

给定一个整数 $n$,计算满足 $1 \le x \le n$ 的好整数的个数。

输入格式

每个测试文件中仅包含一组测试数据。 第一行包含一个整数 $n$ ($1 \le n \le 10^{12}$)。

输出格式

输出一行,包含一个整数,表示满足 $1 \le x \le n$ 的好整数的个数。

样例

样例输入 1

10

样例输出 1

5

样例输入 2

20

样例输出 2

9

样例输入 3

50

样例输出 3

17

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.