結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー hosobikihosobiki
提出日時 2018-07-05 11:16:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 825 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 8,124 KB
最終ジャッジ日時 2023-09-13 17:43:26
合計ジャッジ時間 1,448 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,872 KB
testcase_01 AC 17 ms
8,028 KB
testcase_02 AC 16 ms
7,876 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 16 ms
7,964 KB
testcase_06 AC 15 ms
8,044 KB
testcase_07 AC 15 ms
7,944 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

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
        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