結果

問題 No.2067 ±2^k operations
ユーザー とりゐとりゐ
提出日時 2022-09-02 23:12:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 529 ms / 2,000 ms
コード長 212 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 82,384 KB
実行使用メモリ 183,904 KB
最終ジャッジ日時 2024-04-27 22:54:11
合計ジャッジ時間 8,087 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
51,840 KB
testcase_01 AC 215 ms
85,944 KB
testcase_02 AC 160 ms
84,004 KB
testcase_03 AC 258 ms
85,752 KB
testcase_04 AC 246 ms
85,780 KB
testcase_05 AC 209 ms
85,460 KB
testcase_06 AC 97 ms
76,672 KB
testcase_07 AC 504 ms
178,472 KB
testcase_08 AC 497 ms
183,696 KB
testcase_09 AC 512 ms
183,400 KB
testcase_10 AC 508 ms
182,164 KB
testcase_11 AC 497 ms
179,292 KB
testcase_12 AC 503 ms
182,476 KB
testcase_13 AC 440 ms
179,248 KB
testcase_14 AC 513 ms
183,900 KB
testcase_15 AC 517 ms
181,672 KB
testcase_16 AC 529 ms
183,904 KB
testcase_17 AC 152 ms
79,560 KB
testcase_18 AC 92 ms
75,920 KB
testcase_19 AC 91 ms
76,032 KB
testcase_20 AC 94 ms
76,100 KB
testcase_21 AC 95 ms
76,128 KB
testcase_22 AC 99 ms
75,968 KB
testcase_23 AC 97 ms
76,344 KB
権限があれば一括ダウンロードができます

ソースコード

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