結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー hosobiki
提出日時 2018-07-05 11:12:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 786 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-07-01 02:23:36
合計ジャッジ時間 1,646 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

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
        #print("tap:" + str(tap_count),"total biskets:" + str(bisckets_total),"next biskets:" + str(bisckets_ini))
        
    print(tap_total)
    
if __name__ == "__main__":
    main()
0