No.3152 neither multiple of A nor B
問題文最終更新日: 2025-05-20 20:23:53
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
Math Cafe 1
(順位表)
の他の問題:
Problem Statement
You are given a non-negative integer $N$. Among the non-negative integers less than or equal to $N$, how many are neither a multiple of $A$ nor a multiple of $B$?
Constraints
- $1 \leq N \leq 10^{18}$
- $1 \leq A \leq B \leq 10^9$
- All inputs are integers.
Input
$N$ $A$ $B$
Output
Print a newline at the end.
Sample
Sample 1
Input
6 2 3
Output
2
The non-negative integers less than or equal to $6$ that are neither a multiple of $2$ nor a multiple of $3$ are $1$ $,$ $5$, which is $2$ numbers, so print $2$.
Sample 2
Input
1 1 1
Output
0
Sample 3
Input
43 12 18
Output
39
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
Cafe1942
kazuppa