No.3688 LCM Sum
レベル :
/ AI推定難易度 : 2250
/ 実行時間制限 : 1ケース 3.000秒 / メモリ制限
: 1024 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 26
作問者 :
Unbakedbread
/ テスター :
Tamiji153
タグ : / 解いたユーザー数 26
作問者 :
問題文最終更新日: 2026-09-01 22:35:46
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 completely contains Problem A. By submitting code that is accepted for this problem to Problem A, you can get Problem A accepted.
You are given positive integers $N,M$.
Over all pairs of a positive integer $a$ not greater than $N$ and a positive integer $b$ not greater than $M$, find the sum of the least common multiple of $a$ and $b$, modulo $998244353$.
Constraints
- $N,M$ are integers between $1$ and $3\times 10^7$, 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
30000000 30000000
Output
973741238
Note that you should output the remainder when divided by $998244353$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。