結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー ondy_candy
提出日時 2016-04-22 01:22:30
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 546 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 17,576 KB
最終ジャッジ日時 2024-10-04 14:36:54
合計ジャッジ時間 12,595 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/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