結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー hosobikihosobiki
提出日時 2018-07-05 11:12:58
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 786 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 10,740 KB
実行使用メモリ 8,092 KB
最終ジャッジ日時 2023-09-13 17:43:19
合計ジャッジ時間 1,567 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 15 ms
7,908 KB
testcase_02 AC 15 ms
7,920 KB
testcase_03 AC 15 ms
7,872 KB
testcase_04 AC 15 ms
7,944 KB
testcase_05 AC 15 ms
7,904 KB
testcase_06 AC 16 ms
8,076 KB
testcase_07 WA -
testcase_08 AC 15 ms
7,920 KB
testcase_09 AC 15 ms
7,972 KB
testcase_10 AC 15 ms
8,004 KB
testcase_11 AC 16 ms
7,916 KB
testcase_12 AC 15 ms
8,012 KB
testcase_13 AC 15 ms
7,872 KB
testcase_14 AC 16 ms
7,920 KB
testcase_15 AC 15 ms
8,056 KB
testcase_16 AC 15 ms
7,980 KB
testcase_17 AC 15 ms
7,976 KB
testcase_18 AC 15 ms
8,052 KB
testcase_19 AC 15 ms
8,088 KB
testcase_20 AC 15 ms
8,040 KB
testcase_21 AC 15 ms
8,092 KB
testcase_22 AC 16 ms
8,040 KB
testcase_23 AC 16 ms
7,840 KB
権限があれば一括ダウンロードができます

ソースコード

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