結果

問題 No.47 ポケットを叩くとビスケットが2倍
コンテスト
ユーザー ondy_candy
提出日時 2016-04-22 01:22:30
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 546 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 389 ms
コンパイル使用メモリ 14,976 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2026-09-10 04:59:03
合計ジャッジ時間 42,421 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/usr/bin/env python
# -*- coding: utf-8 -*-

def main():
    n = int(input())

    biscuits = 1
    counter = 0
    while True:
        if biscuits == n:
            break
        elif biscuits * 2 <= n:
            biscuits = biscuits * 2
        else:
            for i in range(1, biscuits + 1):
                a = biscuits - i
                b = i
                if a * 2 + i <= n:
                    biscuits = a * 2 + i
                    break
        counter += 1
    
    print(counter)
    
if __name__ == '__main__':
    main()
0