問題一覧 > 通常問題

No.2880 Max Sigma Mod

レベル : / AI推定難易度 : 1100 / 実行時間制限 : 1ケース 3.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 77
作問者 : Iroha_3856 / テスター : Rac hiro1729 tikuwa_
お気に入りにしたユーザー ProblemId : 11061 / 自分の提出
問題文最終更新日: 2024-09-08 08:23:48
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 445 (菁々祭プログラミングコンテスト2024) (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。