結果

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

ソースコード

diff #

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

const ll MOD = 998244353;

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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