結果

問題 No.1010 折って重ねて
ユーザー yomo3
提出日時 2020-06-08 23:01:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 496 bytes
コンパイル時間 1,952 ms
コンパイル使用メモリ 165,672 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 17:31:35
合計ジャッジ時間 3,838 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll = long long;

int dfs(int x, int y, int h)
{
    if ((x & 1) || (y & 1)) {
        x <<= 1;
        y <<= 1;
        h <<= 1;
    }

    int a1 = 0, a2 = 0;
    if (x > h) {
        a1 = 1 + dfs(x/2, y, h*2);
    }
    if (y > h) {
        a2 = 1 + dfs(x, y/2, h*2);
    }
    return max(a1, a2);
}

int main()
{
    ll x, y, h;
    cin >> x >> y >> h;
    x *= 1000;
    y *= 1000;

    int ans = dfs(x, y, h);

    cout << ans << endl;
}
0