結果
| 問題 | No.2416 vs Slime | 
| コンテスト | |
| ユーザー |  LaFolia13 | 
| 提出日時 | 2023-07-29 16:16:09 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 459 bytes | 
| コンパイル時間 | 1,626 ms | 
| コンパイル使用メモリ | 166,416 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-08 02:40:29 | 
| 合計ジャッジ時間 | 3,008 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 37 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;
#define ALL(x) x.begin(), x.end()
constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;
int main() {
  llong H, A;
  cin >> H >> A;
  llong ans = 0;
  llong cnt = 1;
  while (H) {
    cerr << H << " " << ans << " " << cnt << endl;
    H /= A;
    ans += cnt;
    cnt *= 2;
  }
  cout << ans << endl;
  return 0;
}
            
            
            
        