結果

問題 No.2891 Mint
ユーザー 👑 seekworser
提出日時 2024-07-05 14:23:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 359 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 75,520 KB
最終ジャッジ日時 2024-07-05 14:23:26
合計ジャッジ時間 5,228 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import isqrt

mod = 998244353
n,m = map(int, input().split())

k = isqrt(m)
ans = 0
for i in range(1, k+1):
    ans += (m % i)
    ans %= mod

for d in range(0, m//k+1):
    r = n+1 if d == 0 else min(m // d + 1, n+1)
    l = max(m // (d+1) + 1, k+1)
    if r <= l: continue
    ans += m * (r-l) - (r-l) * (l+r-1) // 2 * d
    ans %= mod
print(ans)
0