#P4359. [CQOI2016] 伪光滑数

    ID: 3290 远端评测题 3000ms 500MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>搜索2016重庆各省省选左偏树素数判断,质数,筛法

[CQOI2016] 伪光滑数

Description

If a positive integer M>1M > 1 has kk terms in its prime factorization, its largest prime factor is aka_k, and it satisfies akkNa_k^k \le N, ak<128a_k < 128, then MM is called an NN-pseudo-smooth number.

Given NN, among all integers, find the KK-th largest NN-pseudo-smooth number.

Clarification: Let M=36=22×32M = 36 = 2^2 \times 3^2. Then the corresponding k=4k = 4. That is, by the Fundamental Theorem of Arithmetic, write M=i=1npiciM = \prod_{i=1}^n p_i^{c_i} and k=i=1ncik = \sum_{i=1}^n c_i. “KK-th largest” is literal: the KK-th from largest to smallest.

Modified by expect2004 on 2020-11-25; this may be his last contribution to the Luogu public problem set before retirement.

Input Format

One line with two space-separated integers NN and KK.

Output Format

One line containing a single integer, the answer.

12345 20
9167

Hint

For 30%30\% of the testdata, N106N \le 10^6.
For 100%100\% of the testdata, 2N1018,1K8000002 \le N \le 10^{18}, 1 \le K \le 800000. It is guaranteed that there are at least KK numbers that satisfy the requirements.

Translated by ChatGPT 5