题目描述:
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 ≤ 1015, 1 ≤ k ≤ 109).
输出描述:
If n has less than k divisors, output -1.
Otherwise, output the k-th smallest divisor of n.
输入:
4 2
5 3
12 5
输出:
2
-1
6
题意:
给你两个数n和k,求n的第k小的因子,或者指出n没有这么多因子。
题解:
两个vector记录一下
代码:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include