ユニークビジョンプログラミングコンテスト2023 春 (AtCoder Beginner Contest 300)
翻译中…
Problem Statement
翻译中…
A positive integer is called a $k$-smooth number if none of its prime factors exceeds $k$.
Given an integer $N$ and a prime $P$ not exceeding $100$, find the number of $P$-smooth numbers not exceeding $N$.
翻译中…
Constraints
翻译中…
$N$is an integer such that$1 \le N \le 10^{16}$.$P$is a prime such that$2 \le P \le 100$.
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
N P
翻译中…
Output
翻译中…
Print the answer as an integer.
翻译中…
样例
Input #1
36 3
Output #1
14
The $3$-smooth numbers not exceeding $36$ are the following $14$ integers: $1,2,3,4,6,8,9,12,16,18,24,27,32,36$.
Note that $1$ is a $k$-smooth number for all primes $k$.
Input #2
10000000000000000 97
Output #2
2345134674
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。