103180: [Atcoder]ABC318 A - Full Moon

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

Description

Score : $100$ points

Problem Statement

Takahashi likes full moons.

Let today be day $1$. The first day on or after today on which he can see a full moon is day $M$. After that, he can see a full moon every $P$ days, that is, on day $M+P$, day $M+2P$, and so on.

Find the number of days between day $1$ and day $N$, inclusive, on which he can see a full moon.

Constraints

  • $1\leq N\leq 2\times 10^5$
  • $1\leq M \leq P \leq 2\times 10^5$
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

$N$ $M$ $P$

Output

Print the answer as an integer.


Sample Input 1

13 3 5

Sample Output 1

3

He can see a full moon on day $3$, $8$, $13$, $18$, and so on.

From day $1$ to $13$, he can see a full moon on three days: day $3$, $8$, and $13$.


Sample Input 2

5 6 6

Sample Output 2

0

There may be no days he can see a full moon.


Sample Input 3

200000 314 318

Sample Output 3

628

Output

得分:100分

问题描述

高桥君喜欢满月。

设今天为第1天。他能看到的第一个满月将在第$M$天。之后,他每隔$P$天就能看到一次满月,即在第$M+P$天,第$M+2P$天,等等。

找出从第1天到第$N$天(含第$N$天)他能看到满月的天数。

限制条件

  • $1\leq N\leq 2\times 10^5$
  • $1\leq M \leq P \leq 2\times 10^5$
  • 所有输入值都是整数。

输入

输入从标准输入按以下格式给出:

$N$ $M$ $P$

输出

将答案作为整数输出。


样例输入1

13 3 5

样例输出1

3

他可以在第3天、第8天、第13天、第18天等看到满月。

从第1天到第13天,他可以在三天内看到满月:第3天、第8天和第13天。


样例输入2

5 6 6

样例输出2

0

可能没有他能看到满月的天数。


样例输入3

200000 314 318

样例输出3

628

HINT

一个月有n天,从第x天开始,每y天都可以看到月亮,一个月内可以看到多少次月亮?

加入题单

算法标签: