結果
問題 | No.1573 Divisor Function |
ユーザー |
![]() |
提出日時 | 2021-06-27 13:58:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 562 bytes |
コンパイル時間 | 3,380 ms |
コンパイル使用メモリ | 194,936 KB |
最終ジャッジ日時 | 2025-01-22 14:10:42 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/modint>int main() {using namespace std;cin.tie(nullptr)->sync_with_stdio(false);int n, m;cin >> n >> m;m = min(m, n);using Mint = atcoder::modint998244353;Mint ans;for (int d = 1; d <= min(m, int(1e5)); ++d) {Mint q = n / d;ans += d * q * (q + 3) / 2;}for (int d = int(1e5) + 1; d <= m;) {int q = n / d;int nd = min(n / q, m) + 1;ans += Mint(q) * (q + 3) / 2 * (d + nd - 1) * (nd - d) / 2;d = nd;}cout << ans.val() << '\n';}