No.3686 Coprime Sum
レベル :
/ AI推定難易度 : 1700
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 1024 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 38
作問者 :
Unbakedbread
/ テスター :
Tamiji153
タグ : / 解いたユーザー数 38
作問者 :
問題文最終更新日: 2026-08-09 16:06:57
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
You are given positive integers $N$ and $M$.
Over all pairs of a positive integer $a$ not exceeding $N$ and a positive integer $b$ not exceeding $M$ such that $a$ and $b$ are coprime, find the sum of $ab$, modulo $998244353$.
Constraints
- $N,M$ are integers between $1$ and $10^7$, inclusive
Input
$N\ M$
Output
Output the answer.Sample
Sample 1
Input
3 5
Output
69
$1\cdot1+1\cdot2+1\cdot3+1\cdot4+1\cdot5+2\cdot1+2\cdot3+2\cdot5+3\cdot1+3\cdot2+3\cdot4+3\cdot5=69$.
Sample 2
Input
31 13
Output
29391
Sample 3
Input
10000000 10000000
Output
283556728
Note that you should output the remainder when divided by $998244353$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。