結果

問題 No.47 ポケットを叩くとビスケットが2倍
コンテスト
ユーザー hosobiki
提出日時 2018-07-05 11:16:16
言語 Python3
(3.14.3 + numpy 2.4.2 + scipy 1.17.0)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 825 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 328 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 15,580 KB
最終ジャッジ日時 2026-03-21 18:54:02
合計ジャッジ時間 3,307 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 4 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
import math

def main():
    text = sys.stdin.readline()
    bisckets_n =  int(text)
    bisckets_ini = 1
    bisckets_total = 0
    tap_count = 0
    tap_total = 0
    
    while (bisckets_n - bisckets_total) > 1:
        tap_count = math.floor((math.log10(bisckets_n - bisckets_total) - math.log10(bisckets_ini)) / math.log10(2))
        bisckets_total += pow(bisckets_ini * 2,tap_count)
        if (bisckets_n - bisckets_total) == 1 :
            bisckets_ini = 1.0
        else:
            bisckets_ini = math.floor((bisckets_n - bisckets_total) / 2)
        tap_total +=  tap_count
        bisckets_total -= bisckets_ini
        #print("tap:" + str(tap_count),"total biskets:" + str(bisckets_total),"next biskets:" + str(bisckets_ini))
        
    print(tap_total)
    
if __name__ == "__main__":
    main()
0