結果
| 問題 |
No.1573 Divisor Function
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2021-06-27 13:56:13 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 544 bytes |
| コンパイル時間 | 2,082 ms |
| コンパイル使用メモリ | 196,152 KB |
| 最終ジャッジ日時 | 2025-01-22 14:08:02 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 RE * 11 |
ソースコード
#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;
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';
}
risujiroh