結果

問題 No.1010 折って重ねて
ユーザー erbowl
提出日時 2020-04-29 11:15:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 515 bytes
コンパイル時間 2,391 ms
コンパイル使用メモリ 197,688 KB
最終ジャッジ日時 2025-01-10 03:18:42
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;

int main() {
    ld x,y,h;
    std::cin >> x>>y>>h;
    h/= 1000.0;
    vector<ld> a = {x,y};
    bool ok = false;
    
    ll cnt = 0;
    while(true){
        sort(a.begin(),a.end());
        if(a[0]<=h){
            ok = true;
        }
        
        if(a[ok]>h){
            a[ok] /= 2;
            h *= 2;
        }else{
            break;
        }
        cnt++;
    }
    std::cout << cnt << std::endl;
    
}

0