No.3689 LCM Sum (Easy Version)
レベル :
/ AI推定難易度 : 151
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 1024 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 66
作問者 :
Unbakedbread
/ テスター :
Tamiji153
タグ : / 解いたユーザー数 66
作問者 :
問題文最終更新日: 2026-08-09 16:35:19
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
Problem Statement
*This problem is a subproblem of Problem G. A code that is accepted for Problem G can also be accepted for this problem by submitting it here.
You are given positive integers $N,M$.
Find the sum of the least common multiples of $a$ and $b$ over all pairs of a positive integer $a$ not greater than $N$ and a positive integer $b$ not greater than $M$, modulo $998244353$.
Constraints
- $N,M$ are integers between $1$ and $10^3$, inclusive
Input
$N\ M$
Output
Output the answer.Sample
Sample 1
Input
2 3
Output
16
We have $lcm(1,1)+lcm(1,2)+lcm(1,3)+lcm(2,1)+lcm(2,2)+lcm(2,3)=1+2+3+2+2+6=16$.
Sample 2
Input
31 13
Output
34342
Sample 3
Input
1000 1000
Output
332588061
Note that you should output the remainder when divided by $998244353$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。