Codeforces--762A--k-th divisor

博客介绍了如何解决Codeforces编程竞赛中的一道题目,762A--k-th divisor。内容涉及寻找一个整数n的第k小的因子,如果因子数量少于k,则输出-1。博主分享了题目的输入输出示例及解题思路,包括使用两个向量记录因子的方法。
摘要由CSDN通过智能技术生成

题目描述:
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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值