結果

問題 No.1184 Hà Nội
ユーザー mencotton
提出日時 2020-08-22 13:31:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 592 ms
コンパイル使用メモリ 68,112 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-15 07:46:31
合計ジャッジ時間 1,582 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

constexpr ll MOD = 998244353;

ll calc_pow(ll x, ll pow) {
    if (pow == 0) return 1;
    ll a = calc_pow(x, pow / 2);
    a = a * a % MOD;
    if (pow % 2 == 1) a *= x;
    return a % MOD;
}

int main() {
    ll n, l;
    cin >> n >> l;
    ll x = (n + l - 1) / l;
    cout << (calc_pow(2, x) + MOD - 1) % MOD << endl;
    return 0;
}
0