結果

問題 No.1010 折って重ねて
ユーザー horiesiniti
提出日時 2023-02-11 01:28:24
言語 Ruby
(3.4.1)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-07-07 18:38:39
合計ジャッジ時間 4,725 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def f(x,y,h)
ans=0
ansx=0
h2=h
h4=h
200.times{|i|
	
	h2a=h2
	ansy=0
	while h2a<y do
		h2a*=4
		ansy+=1
	end
	ans=[ans,ansx+ansy].max
	break if x<=h4
	ansx+=1
	h2*=2
	h4*=4
}
return ans
end

x,y,h=gets.split.map{|e| e.to_i}
x*=1000
y*=1000
ans=[0,f(x,y,h),f(y,x,h)].max
puts ans
0