結果

問題 No.2113 Distance Sequence 1.5
ユーザー StstoneStstone
提出日時 2022-11-23 14:53:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,221 bytes
コンパイル時間 2,483 ms
コンパイル使用メモリ 211,244 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-25 00:07:50
合計ジャッジ時間 3,432 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll,ll> pii;
#define F first
#define S second
#define pb push_back
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define bug(x) cerr << (x) << ' '
#define debug(x) cerr << #x << " = " << x << '\n'
#define yn(x) cout << (x==1?"Yes\n":"No\n")
#define PI 3.14159265358979323
#define Ststone ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const ll max_n=1e6+20,max_int=2147483647,mod1=1e9+7,mod2=998244353;
bool online = 0;
ll t,n,m,a,b,c,d,k,e;


ll modpow(ll x,ll y){
    x = x%mod2;
    ll ret = 1;
    while(y){
        if(y&1){
            ret = (ret*x)%mod2;
        }
        x = (x*x)%mod2;
        y >>= 1;
    }
    return ret;
}

void solve(){
    cin >> n >> m >> k;
    ll cnt1 = modpow(min(k,m),2*n)%mod2;
    ll cnt2 = (modpow(min(k,m),2*n)-modpow(min(k,m)-1,2*n)+mod2)%mod2;
    ll ans = (cnt1+cnt2*(max(m-k,0ll)%mod2))%mod2;
    cout << ans << '\n';
}

int main(){
    if(online){
        #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #else
        #endif
    }
    Ststone;
    solve();
}

/*

*/
0