結果

問題 No.47 ポケットを叩くとビスケットが2倍
コンテスト
ユーザー dashi_dragons
提出日時 2017-02-10 18:32:08
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 20 ms / 5,000 ms
+ 627µs
コード長 389 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 56 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2026-10-08 09:29:17
合計ジャッジ時間 1,926 ms
ジャッジサーバーID
(参考情報)
judge4_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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