結果

問題 No.378 名声値を稼ごう
ユーザー mesame3993mesame3993
提出日時 2021-11-18 15:23:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 856 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 71,548 KB
最終ジャッジ日時 2023-08-27 01:28:26
合計ジャッジ時間 2,111 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,548 KB
testcase_01 AC 72 ms
71,224 KB
testcase_02 AC 72 ms
71,472 KB
testcase_03 AC 73 ms
71,176 KB
testcase_04 AC 73 ms
71,408 KB
testcase_05 AC 73 ms
71,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  from sys import stdin
  readline=stdin.readline
  n = int(readline())
  #s = input()
  #a,b = map(int, readline().split())
  #A = list(map(int, readline().split()))
  l = [n]
  while n:
    n //= 2
    l.append(n)
  tmp = sum(l)
  for i in range(len(l)-1):
    if sum(l[i+1:]) >= l[i]:
      continue
    print(sum(l[:i])+2*l[i] - tmp)
    break
main()
0