結果

問題 No.2416 vs Slime
ユーザー xuelei
提出日時 2023-08-12 13:40:35
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 611 bytes
コンパイル時間 1,517 ms
コンパイル使用メモリ 165,068 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-19 15:51:16
合計ジャッジ時間 2,634 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = (int)(a); (i) < (int)(b); (i)++)
#define rrep(i, a, b) for (int i = (int)(b) - 1; (i) >= (int)(a); (i)--)
#define all(v) v.begin(), v.end()

typedef long long ll;
template <class T> using V = vector<T>;
template <class T> using VV = vector<V<T>>;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    constexpr char endl = '\n';

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