結果

問題 No.2416 vs Slime
ユーザー a01sa01toa01sa01to
提出日時 2023-08-12 13:37:42
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 2,021 ms
コンパイル使用メモリ 199,052 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-19 15:44:47
合計ジャッジ時間 3,109 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
  #define _GLIBCXX_DEBUG
#else
  #define Debug(...) void(0)
#endif
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); ++i)

int main() {
  ll h, a;
  cin >> h >> a;
  ll ans = 0, cnt = 1;
  while (h > 0) {
    ans += cnt;
    cnt *= 2;
    h /= a;
  }
  cout << ans << endl;
  return 0;
}
0