QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 1024 MB Points totaux : 100 Hackable ✓

#5715. Powers

Statistiques

Xiao $\Omega$ learned the concept of "powers" in elementary school mathematics: $\forall a, b \in \mathbb{N}^+$, $a^b$ is defined as the product of $b$ copies of $a$.

She is curious about how many positive integers can be represented in the form $a^b$ mentioned above. Since all positive integers $m \in \mathbb{N}^+$ can always be represented as $m^1$, she requires that in the representation above, $b \geq k$, where $k$ is a positive integer she has chosen in advance.

Therefore, she wants to know how many positive integers $x$ in the range $1$ to $n$ can be represented in the form $x = a^b$, where $a$ and $b$ are both positive integers and $b \geq k$.

Input

The input contains two positive integers $n$ and $k$, as described above.

Output

Output a single non-negative integer representing the corresponding answer.

Examples

Input 1

99 1

Output 1

99

Note 1

Since all positive integers $x \in [1, 99]$ can be represented as $x = x^1$, the answer is $99$.

Input 2

99 3

Output 2

7

Note 2

The following are all 7 positive integers that satisfy the condition and one valid representation for each:

$1 = 1^3, 8 = 2^3, 16 = 2^4, 27 = 3^3, 32 = 2^5, 64 = 4^3, 81 = 3^4$

Note that some positive integers may have multiple valid representations, for example, $64$ can also be represented as $64 = 2^6$. However, according to the problem, different valid representations of the same number are only counted once.

Input 3

99 2

Output 3

12

Note 3

The following are all 12 positive integers that satisfy the condition and one valid representation for each:

$1 = 1^2, 4 = 2^2, 8 = 2^3, 9 = 3^2, 16 = 4^2, 25 = 5^2$ $27 = 3^3, 32 = 2^5, 36 = 6^2, 49 = 7^2, 64 = 8^2, 81 = 9^2$

Input 4

power/power4.in

Output 4

power/power4.ans

Input 5

power/power5.in

Output 5

power/power5.ans

Input 6

power/power6.in

Output 6

power/power6.ans

Constraints

For all data, it is guaranteed that $1 \leq n \leq 10^{18}$ and $1 \leq k \leq 100$.

Test Case ID $n \leq$ $k$
1 $10^2$ $= 1$
2 $\geq 2$
3 $10^4$ $\geq 3$
4 $\geq 2$
5 $10^6$ $\geq 3$
6 $\geq 2$
7 $10^8$ $\geq 3$
8 $\geq 2$
9 $10^{10}$ $\geq 3$
10 $\geq 2$
11 $10^{12}$ $\geq 3$
12 $\geq 2$
13 $10^{14}$ $\geq 3$
14 $\geq 2$
15 $10^{16}$ $\geq 3$
16 $\geq 2$
17 $10^{18}$ $\geq 3$
18
19 $\geq 2$
20

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.