結果
問題 |
No.2113 Distance Sequence 1.5
|
ユーザー |
|
提出日時 | 2022-10-29 14:52:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 422 bytes |
コンパイル時間 | 1,245 ms |
コンパイル使用メモリ | 168,160 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-06 13:33:42 |
合計ジャッジ時間 | 2,015 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/modint> using namespace std; using namespace atcoder; using mint = modint998244353; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); long long n, m, k; cin >> n >> m >> k; n *= 2; if (m < k) { cout << mint(m).pow(n).val(); } else { cout << ((m - k + 1) * mint(k).pow(n) - (m - k) * mint(k - 1).pow(n)).val() << '\n'; } }