結果

問題 No.2416 vs Slime
ユーザー elphe
提出日時 2024-07-03 19:25:32
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 581 bytes
コンパイル時間 923 ms
コンパイル使用メモリ 97,640 KB
最終ジャッジ日時 2025-02-22 01:54:45
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
#include <functional>

using namespace std;

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    long long H, A, temp;
    long long ans = 0;
    map<long long, long long, greater<long long>> slimes;
    cin >> H >> A;
    slimes.emplace(H, 1);

    while (!slimes.empty())
    {
        temp = slimes.begin()->first / A;
        if (temp != 0)
            slimes[temp] += slimes.begin()->second * 2;
        ans += slimes.begin()->second;
        slimes.erase(slimes.begin());
    }

    cout << ans << '\n';
    return 0;
}
0