結果

問題 No.2067 ±2^k operations
ユーザー とりゐ
提出日時 2022-09-02 23:12:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 634 ms / 2,000 ms
コード長 212 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 82,528 KB
実行使用メモリ 183,920 KB
最終ジャッジ日時 2024-11-16 06:05:33
合計ジャッジ時間 9,407 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

memo={}
memo[0]=0
def calc(n):
  if n in memo:
    return memo[n]
  memo[n]=calc(n//2)+calc((n+3)//4-1)+calc((n+1)//4)+(n+3)//4+(n+1)//4
  return memo[n]

for _ in range(int(input())):
  print(calc(int(input())))
0