結果

問題 No.378 名声値を稼ごう
ユーザー _KingdomOfMoray_KingdomOfMoray
提出日時 2020-01-05 08:33:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 612 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 10,964 KB
実行使用メモリ 8,100 KB
最終ジャッジ日時 2023-09-15 19:43:21
合計ジャッジ時間 687 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,984 KB
testcase_01 AC 16 ms
7,924 KB
testcase_02 AC 17 ms
8,100 KB
testcase_03 AC 17 ms
7,928 KB
testcase_04 AC 16 ms
7,920 KB
testcase_05 AC 17 ms
7,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n = int(input())

normal_list = []
cumula_list = [] # cumulative_list
skill_list = []
cur = n

while True:
    normal_list.append(cur)
    cur = cur // 2
    if cur < 1:
        break

for i in range(len(normal_list)):
    if i == 0:
        cumula_list.append(normal_list[i])
    else:
        cumula_list.append(cumula_list[i - 1] + normal_list[i])
        
for i in range(len(normal_list)):
    if i == 0:
        skill_list.append(2 * cumula_list[i])
    else:
        skill_list.append(cumula_list[i - 1] + 2 * normal_list[i])
        
print(max(skill_list) - cumula_list[len(cumula_list) - 1])
0