結果

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

ソースコード

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:
        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))
        bisckets_total -= bisckets_ini
        
    print(tap_total)
    
if __name__ == "__main__":
    main()
0