题库练习 k-th divisor
← 上一题 下一题 →

A10859 | k-th divisor

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You are given two integers $n$ and $k$ . Find $k$ -th smallest divisor of $n$ , or report that it doesn't exist.

Divisor of $n$ is any such natural number, that $n$ can be divided by it without remainder.

输入格式

The first line contains two integers $n$ and $k$ ( $1<=n<=10^{15}$ , $1<=k<=10^{9}$ ).

输出格式

If $n$ has less than $k$ divisors, output -1.

Otherwise, output the $k$ -th smallest divisor of $n$ .

输入输出样例

输入 #1
4 2
输出 #1
2
输入 #2
5 3
输出 #2
-1
输入 #3
12 5
输出 #3
6
C++ 编辑器
输入
输出