結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー takopom55
提出日時 2016-11-30 00:06:10
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 307 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-27 13:51:26
合計ジャッジ時間 1,444 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())
    hit = 0
    biscuit = 1

    while biscuit * 2 < N:
        biscuit = biscuit * 2
        hit += 1
    
    if (N - biscuit) >= 2:
        hit += ((N - biscuit) & 1) + 1
    elif (N - biscuit) == 1:
        hit += 1

    print(hit)

if __name__ == '__main__':
    main()
0