結果

問題 No.2067 ±2^k operations
ユーザー とりゐ
提出日時 2022-08-30 17:37:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 712 ms / 2,000 ms
コード長 226 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 183,908 KB
最終ジャッジ日時 2024-11-07 12:01:45
合計ジャッジ時間 11,253 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

memo={}
def calc(n):
  if n<=0:
    return 0
  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