結果

問題 No.1286 Stone Skipping
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-06-15 13:33:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 539 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 76,804 KB
最終ジャッジ日時 2023-08-27 04:35:20
合計ジャッジ時間 4,662 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
75,440 KB
testcase_01 AC 78 ms
75,548 KB
testcase_02 AC 81 ms
76,568 KB
testcase_03 AC 81 ms
75,588 KB
testcase_04 AC 82 ms
75,528 KB
testcase_05 AC 80 ms
75,548 KB
testcase_06 AC 79 ms
75,660 KB
testcase_07 AC 79 ms
75,560 KB
testcase_08 AC 84 ms
76,576 KB
testcase_09 AC 82 ms
76,316 KB
testcase_10 AC 86 ms
76,632 KB
testcase_11 AC 82 ms
76,732 KB
testcase_12 AC 85 ms
76,576 KB
testcase_13 AC 79 ms
76,792 KB
testcase_14 AC 80 ms
76,344 KB
testcase_15 AC 82 ms
76,572 KB
testcase_16 AC 82 ms
76,680 KB
testcase_17 AC 82 ms
76,760 KB
testcase_18 AC 78 ms
75,484 KB
testcase_19 AC 77 ms
75,472 KB
testcase_20 AC 82 ms
76,532 KB
testcase_21 AC 81 ms
76,340 KB
testcase_22 AC 84 ms
76,572 KB
testcase_23 AC 82 ms
76,576 KB
testcase_24 AC 81 ms
76,748 KB
testcase_25 AC 81 ms
76,804 KB
testcase_26 AC 82 ms
76,624 KB
testcase_27 AC 83 ms
76,516 KB
testcase_28 AC 82 ms
76,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

d=int(input())
"""
最後の飛距離は1
最後から2回目は2,3
最後から3回目は4,5,6,7
最後から4回目は8~15
最後からi回目は[2**(i-1),2**2)
答えはd/2以上d以下
跳ねる回数で場合分け
跳ねる回数最大60回ぐらい
"""
ans=d
for i in range(1,64):
	def func(x):
		# x始まりでi回跳ねる場合の飛距離
		tmp=0
		for _ in range(i):
			tmp+=x
			x//=2
		return tmp
	l,r=0,d
	while r-l>1:
		x=(l+r)//2
		if d<func(x):
			l,r=l,x
		else:
			l,r=x,r
	if func(l)==d:
		ans=min(ans,l)

print(ans)
0