結果

問題 No.1184 Hà Nội
ユーザー Sooh31
提出日時 2020-08-22 14:30:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 581 bytes
コンパイル時間 3,198 ms
コンパイル使用メモリ 191,316 KB
最終ジャッジ日時 2025-01-13 08:42:56
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
using ll = long long;
using graph = vector<vector<int>>;

const ll mod = 998244353;
const int INF = 1001001001;

ll modpow(ll a, ll p){
    ll ret = 1;
    while(p){
        if(p & 1) ret = ret * a % mod;
        a = a * a % mod;
        p >>= 1;
    }
    return ret;
}

int main(){
    ll n, k; cin >> n >> k;
    ll ans = 1;
    if(n <= k){
        cout << ans << endl;
        return 0;
    }
    else{
        ll tmp = (n + k - 1) / k;
        cout << modpow(2, tmp) - 1 << endl;
    }
}
0