結果

問題 No.1010 折って重ねて
ユーザー misora192misora192
提出日時 2020-04-12 14:27:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 645 bytes
コンパイル時間 1,605 ms
コンパイル使用メモリ 166,816 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-22 02:35:20
合計ジャッジ時間 2,967 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

const int max_b = 60;
bool can[max_b][max_b];

ll x, y, h;

void rec(int i, int j){
	if(!can[i+1][j] && x * 1000 > h * (1ll << (2 * i + j))){
		can[i+1][j] = true;
		rec(i+1, j);
	}

	if(!can[i][j+1] && y * 1000 > h * (1ll << (i + 2 * j))){
		can[i][j+1] = true;
		rec(i, j+1);
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> x >> y >> h;

	rep(i, max_b) rep(j, max_b) can[i][j] = false;

	rec(0, 0);
		
	int ans = 0;
	rep(i, max_b) rep(j, max_b) if(can[i][j]) ans = max(ans, i + j);
	cout << ans << endl;

}
0