結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー dashi_dragons
提出日時 2017-02-10 18:32:08
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 37 ms / 5,000 ms
コード長 389 bytes
コンパイル時間 528 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-12-26 18:25:48
合計ジャッジ時間 2,212 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def check_range(a,b,x):
	if a > x or b < x:
		sys.exit()

def check_eq(a,b):
	if a != b:
		sys.exit()

def cal(x):
	if x == 1:
		return 0

	elif x == 2:
		return 1

	elif x % 2 == 1:
		buf = cal((x+1) // 2) + 1
#		print(str(x)+'odd')
		return buf
	
	else:
		buf = cal(x // 2) + 1
#		print(str(x)+'even')
		return buf

N = int(input())
check_range(1,100000000,N)

print(cal(N))
0