結果

問題 No.2113 Distance Sequence 1.5
ユーザー karinohito
提出日時 2024-09-24 21:47:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 361 bytes
コンパイル時間 1,732 ms
コンパイル使用メモリ 195,672 KB
最終ジャッジ日時 2025-02-24 12:07:49
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

using ll=long long;
#include<atcoder/modint>
using mint=atcoder::modint998244353;

int main(){
    ll N,M,K;
    cin>>N>>M>>K;
    if(M<K){
        cout<<mint(M).pow(2*N).val()<<endl;
        return 0;
    }
    mint an=mint(M-K)*(mint(K).pow(2*N)-mint(K-1).pow(2*N))+mint(K).pow(2*N);
    cout<<an.val()<<endl;
}

0