結果

問題 No.2416 vs Slime
コンテスト
ユーザー ryota2357
提出日時 2023-06-27 16:06:32
言語 C++17(clang)
(clang++ 21.1.8 + boost 1.89.0)
コンパイル:
clang++ -O2 -lm -std=c++1z -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 365 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,207 ms
コンパイル使用メモリ 129,536 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-03-25 16:42:26
合計ジャッジ時間 5,525 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <cassert>
#include <iostream>
using namespace std;
using ll = long long;

int main() {
    ll H, A;
    cin >> H >> A;
    assert(1 <= H && H <= 1000000000000);
    assert(2 <= A && A <= 1000000000000);
    ll ans = 0;
    ll cnt = 1;
    while (H > 0) {
        H /= A;
        ans += cnt;
        cnt *= 2;
    }
    cout << ans << endl;
    return 0;
}
0