#abc318a. A - Full Moon

A - Full Moon

Score : 100100 points

问题描述

Takahashi 喜欢满月。

假设今天是第 11 天。从今天或之后的第一天,他能看到满月的那一天是第 MM 天。此后,每隔 PP 天他就可以看到一次满月,即在第 M+PM+P 天、第 M+2PM+2P 天,以此类推。

找出从第 11 天到第 NN 天(包括第 11 天和第 NN 天)期间,他能看到满月的天数。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

Takahashi likes full moons.

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

Find the number of days between day 11 and day NN, inclusive, on which he can see a full moon.

Constraints

  • 1N2×1051\leq N\leq 2\times 10^5
  • 1MP2×1051\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:

NN MM PP

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 33, 88, 1313, 1818, and so on.

From day 11 to 1313, he can see a full moon on three days: day 33, 88, and 1313.

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

update @ 2024/3/10 09:04:08