結果

問題 No.2940 Sigma Sigma Div Floor Problem
ユーザー LyricalMaestro
提出日時 2024-10-20 23:48:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 6,000 ms
コード長 493 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 82,476 KB
実行使用メモリ 60,276 KB
最終ジャッジ日時 2024-10-20 23:49:07
合計ジャッジ時間 10,420 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

## https://yukicoder.me/problems/no/2940


MOD = 998244353

def main():
    N = int(input())

    inv2 = pow(2, MOD - 2, MOD)
    answer = 0
    for j in range(1, N + 1):
        n = N // j

        n_tot = (n * (n - 1)) % MOD
        n_tot *= inv2
        n_tot %= MOD

        x = (n + (j * n_tot) % MOD) % MOD

        m = N % j
        x += (n * m) % MOD
        x %= MOD

        answer += x
        answer %= MOD
    
    print(answer)














if __name__ == "__main__":
    main()
0