結果
| 問題 |
No.3364 Push_back Operation
|
| コンテスト | |
| ユーザー |
テナガザル
|
| 提出日時 | 2025-11-17 22:23:28 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 715 bytes |
| コンパイル時間 | 1,000 ms |
| コンパイル使用メモリ | 100,064 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-11-17 22:23:46 |
| 合計ジャッジ時間 | 8,517 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 50 WA * 3 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long pow(long long a, long long k, long long m)
{
long long ret = 1;
for (a %= m; k > 0; k >>= 1, a = a * a % m) if (k & 1) ret = ret * a % m;
return ret;
}
int main()
{
const int mod = 998244353;
long long n;
cin >> n;
auto cal = [&](long long x, long long k) -> long long
{
if (x == 1) return k;
long long ret = pow(x, k + 1, mod) + mod - 1;
return ret * pow(x - 1, mod - 2, mod) % mod;
};
long long x = 1, v = n, ans = 0;
while (x <= n)
{
long long nx = n / v + 1;
ans = (ans + (cal(v, nx - 1) - cal(v, x - 1) + mod)) % mod;
x = nx;
v = n / x;
}
cout << ans << endl;
}
テナガザル