No.2880 Max Sigma Mod
タグ : / 解いたユーザー数 77
作問者 :
Iroha_3856
/ テスター :
Problem Statement
You are given positive integers $N, M$.
Find $\displaystyle \max_{1 \leq x \leq N} \Bigl(\ \sum_{i=1}^M (x \bmod i)\ \Bigr)$.
Input
$N\ M$
All inputs satisfy the following constraints.
- $1 \leq N, M \leq 2 \times 10^{5}$
- $N, M$ are integers
Output
Print the answer, followed by a newline.
Sample
Sample 1
Input
3 2
Output
1
When $x = 1$, $\displaystyle \sum_{i=1}^M (x \bmod i) = 1 \bmod 1 + 1 \bmod 2 = 1$.
When $x = 2$, $\displaystyle \sum_{i=1}^M (x \bmod i) = 2 \bmod 1 + 2 \bmod 2 = 0$.
When $x = 3$, $\displaystyle \sum_{i=1}^M (x \bmod i) = 3 \bmod 1 + 3 \bmod 2 = 1$.
Therefore, print $1$, the maximum of $1, 0, 1$.
Sample 2
Input
173 972
Output
143552
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。