結果

問題 No.1010 折って重ねて
ユーザー chocoruskchocorusk
提出日時 2020-03-20 21:33:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 989 bytes
コンパイル時間 1,037 ms
コンパイル使用メモリ 110,212 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-15 04:23:03
合計ジャッジ時間 2,097 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	ll x, y, h;
	cin>>x>>y>>h;
	x*=1000, y*=1000;
	int a=0, b=0;
	while(x>(1ll<<a)*h) a++;
	while(y>(1ll<<b)*h) b++;
	bool dp[60][60]={};
	dp[a][b]=1;
	for(int i=a; i>=0; i--){
		for(int j=b; j>=0; j--){
			if(!dp[i][j]) continue;
			if(i && i>a+b-i-j) dp[i-1][j]=1;
			if(j && j>a+b-i-j) dp[i][j-1]=1;
		}
	}
	int ans=0;
	for(int i=0; i<=a; i++) for(int j=0; j<=b; j++) if(dp[i][j]) ans=max(ans, a+b-i-j);
	cout<<ans<<endl;
	return 0;
}
0