#P9118. [春季测试 2023] 幂次

    ID: 10187 远端评测题 1000ms 1024MiB 尝试: 0 已通过: 0 显示难度普及+/提高− 上传者: 标签>2023NOIP 提高组O2优化

[春季测试 2023] 幂次

Problem Description

In elementary math class, Little Ω\Omega learned the concept of “powers”: ∀a,b∈N+\forall a, b \in \N^+, define aba^b as the product of bb copies of aa multiplied together.

She is curious about how many positive integers can be written in the form aba^b above. Since every positive integer m∈N+m \in \N^+ can always be written as m1m^1, she requires that in such a representation, we must have b≥kb \geq k, where kk is a positive integer chosen in advance.

Therefore, she wants to know: among the integers from 11 to nn, how many positive integers xx can be written as x=abx = a^b, where aa and bb are both positive integers and b≥kb \geq k?

Input Format

The first line contains two positive integers n,kn, k, with the meanings described above.

Output Format

Output one line containing one non-negative integer representing the corresponding answer.

99 1
99
99 3
7
99 2
12

Hint

[Explanation for Sample 2]

The following are all 77 positive integers that satisfy the requirement, along with 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, 6464 can also be written as 64=2664 = 2^6.

However, according to the statement, different valid representations of the same number are counted only once.

[Explanation for Sample 3]

The following are all 1212 positive integers that satisfy the requirement, along with 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$.

[Sample 4]

See power/power4.in and power/power4.ans in the contestant directory.

[Sample 5]

See power/power5.in and power/power5.ans in the contestant directory.

[Sample 6]

See power/power6.in and power/power6.ans in the contestant directory.

[Constraints]

For all testdata, it is guaranteed that 1≤n≤10181 \leq n \leq 10^{18} and 1≤k≤1001 \leq k \leq 100.

Test Point ID n≤n \le kk
1 10210^2 =1=1
2 ≥2\ge 2
3 10410^4 ≥3\ge 3
4 ≥2\ge 2
5 10610^6 ≥3\ge 3
6 ≥2\ge 2
7 10810^8 ≥3\ge 3
8 ≥2\ge 2
9 101010^{10} ≥3\ge 3
10 ≥2\ge 2
11 101210^{12} ≥3\ge 3
12 ≥2\ge 2
13 101410^{14} ≥3\ge 3
14 ≥2\ge 2
15 101610^{16} ≥3\ge 3
16 ≥2\ge 2
17 101810^{18} ≥3\ge 3
18 ≥2\ge 2
19
20

Translated by ChatGPT 5