問題一覧 > 通常問題

No.3152 neither multiple of A nor B

レベル : / AI推定難易度 : 400 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 130
作問者 : Cafe1942 / テスター : kazuppa sclara
お気に入りにしたユーザー ProblemId : 12267 / 自分の提出
問題文最終更新日: 2025-05-20 20:23:53
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もしくは右上の雲マークをクリックしてアカウントを作成してください。