CF762A.k-th divisor

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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

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

输入格式

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

输出格式

If nn has less than kk divisors, output -1.

Otherwise, output the kk -th smallest divisor of nn .

输入输出样例

  • 输入#1

    4 2
    

    输出#1

    2
    
  • 输入#2

    5 3
    

    输出#2

    -1
    
  • 输入#3

    12 5
    

    输出#3

    6
    

说明/提示

In the first example, number 44 has three divisors: 11 , 22 and 44 . The second one is 22 .

In the second example, number 55 has only two divisors: 11 and 55 . The third divisor doesn't exist, so the answer is -1.

首页