题库练习 [COCI-2011_2012-contest4]#1 BROJ
← 上一题 下一题 →

A1230 | [COCI-2011_2012-contest4]#1 BROJ

来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0

题目描述

Find the N-th smallest positive integer whose least prime factor is P, or state that the result is greater than 10^
9.

输入格式

The first and only line of input contains space seperated integers N and P (1 ≤ N, P ≤ 109). P will always be prime.

输出格式

Output a single line with the expected result, or zero if result exceeds 10^
9.

输入输出样例

输入 #1
1 2
输出 #1
2
输入 #2
2 3
输出 #2
9
输入 #3
1000 1000003 
输出 #3
0
C++ 编辑器
输入
输出