409619: GYM103647 B Friendly Flamingos

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Friendly Flamingostime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

UT Austin has decided to adopt a flamingo on campus named Freddy.

They have allowed students to feed Freddy for the next $$$n$$$ days. However, Freddy has days when he needs to fast and cannot consume food. Assuming that the day he arrived on campus is day 1, there are a couple of rules that Freddy has for the days that he fasts. He will fast on days that are divisible by a certain number $$$k$$$. He has one exception to this rule - he will not fast on a day if the day number is divisible by $$$k^2$$$. Calculate the number of days that Freddy will fast for the next $$$n$$$ days.

Input

There will be one line of input containing two integers. The first integer $$$n$$$ $$$(1 \leq n \leq 10^6)$$$ represents the number of days that Freddy will be on campus. The second integer represents $$$k$$$ $$$(1 \leq k \leq 100)$$$.

Output

Output the number of days that Freddy will be fasting in the next $$$n$$$ days.

ExamplesInput
25 5
Output
4
Input
200 10
Output
18
Note

For the first test case, there are 5 multiples of 5 between 1 and 25. However, since day 25 is divisible by 5, there are 4 days that Freddy will fast.

For the second test case, there are 20 multiples. However, Freddy will not fast on day 100 and 200, leaving 18 fasting days.

加入题单

上一题 下一题 算法标签: