問題一覧 > 通常問題

No.3773 mod A > mod B

レベル : / AI推定難易度 : 111 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 1024 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 81
作問者 : Rapca1256 / テスター : UT0911 👑 p-adic aogera tomorunn
お気に入りにしたユーザー ProblemId : 13732 / 自分の提出
問題文最終更新日: 2026-08-12 23:44:50
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
yukicoder contest 519 (順位表) の他の問題:

Problem Statement

You are given positive integers $N, A, B$. Find the number of positive integers $n$ less than or equal to $N$ that satisfy the following condition.

  • $(n\bmod A) > (n\bmod B)$

Here, $X\bmod Y$ denotes the remainder when $X$ is divided by $Y$.

Input

$N\ A\ B$

The input satisfies the following constraints.

  • All inputs are integers.
  • $1\le N \le 10000$
  • $1 \le A, B \le N$

Output

Output the number of positive integers less than or equal to $N$ that satisfy the condition.
Also, print a newline at the end.

Sample

Sample 1
Input
10 3 5
Output
2

The remainders when $ 1,2,3,4,5,6,7,8,9,10 $ are divided by $3$ and $5$ are as follows.

The remainder of $1$ divided by $3$ is $1$, and divided by $5$ is $1$.
The remainder of $2$ divided by $3$ is $2$, and divided by $5$ is $2$.
The remainder of $3$ divided by $3$ is $0$, and divided by $5$ is $3$.
The remainder of $4$ divided by $3$ is $1$, and divided by $5$ is $4$.
The remainder of $5$ divided by $3$ is $2$, and divided by $5$ is $0$.
The remainder of $6$ divided by $3$ is $0$, and divided by $5$ is $1$.
The remainder of $7$ divided by $3$ is $1$, and divided by $5$ is $2$.
The remainder of $8$ divided by $3$ is $2$, and divided by $5$ is $3$.
The remainder of $9$ divided by $3$ is $0$, and divided by $5$ is $4$.
The remainder of $10$ divided by $3$ is $1$, and divided by $5$ is $0$.

Therefore, only the two values $n=5, 10$ satisfy the condition.

Sample 2
Input
1 1 1
Output
0

Sample 3
Input
2026 20 26
Output
702

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。