結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー megumeguromegumeguro
提出日時 2020-04-12 14:21:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 214 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 11,764 KB
実行使用メモリ 10,092 KB
最終ジャッジ日時 2023-10-22 01:13:18
合計ジャッジ時間 1,793 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 26 ms
10,092 KB
testcase_02 AC 25 ms
10,092 KB
testcase_03 AC 25 ms
10,092 KB
testcase_04 RE -
testcase_05 AC 25 ms
10,092 KB
testcase_06 AC 27 ms
10,092 KB
testcase_07 AC 26 ms
10,092 KB
testcase_08 RE -
testcase_09 AC 24 ms
10,092 KB
testcase_10 RE -
testcase_11 AC 25 ms
10,092 KB
testcase_12 AC 24 ms
10,092 KB
testcase_13 AC 26 ms
10,092 KB
testcase_14 RE -
testcase_15 AC 26 ms
10,092 KB
testcase_16 AC 25 ms
10,092 KB
testcase_17 AC 24 ms
10,092 KB
testcase_18 AC 24 ms
10,092 KB
testcase_19 AC 26 ms
10,092 KB
testcase_20 AC 26 ms
10,092 KB
testcase_21 AC 26 ms
10,092 KB
testcase_22 AC 25 ms
10,092 KB
testcase_23 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
import bisect
N = int(input())

l = [2**i for i in range(27)]

a = bisect.bisect_left(l,N)

ans = a
N -= l[a]
for i in range(a,-1,-1):
    if l[i] < N:
        N -= l[i]
        ans += 1

print(ans)
0