結果

問題 No.2067 ±2^k operations
ユーザー とりゐとりゐ
提出日時 2022-08-30 17:37:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 565 ms / 2,000 ms
コード長 226 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 184,096 KB
最終ジャッジ日時 2024-04-25 02:28:56
合計ジャッジ時間 8,348 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,712 KB
testcase_01 AC 211 ms
86,212 KB
testcase_02 AC 170 ms
84,764 KB
testcase_03 AC 230 ms
85,216 KB
testcase_04 AC 255 ms
86,792 KB
testcase_05 AC 227 ms
85,360 KB
testcase_06 AC 99 ms
77,056 KB
testcase_07 AC 521 ms
179,124 KB
testcase_08 AC 542 ms
183,840 KB
testcase_09 AC 549 ms
183,536 KB
testcase_10 AC 539 ms
182,304 KB
testcase_11 AC 504 ms
179,404 KB
testcase_12 AC 536 ms
182,464 KB
testcase_13 AC 477 ms
179,756 KB
testcase_14 AC 565 ms
184,096 KB
testcase_15 AC 557 ms
181,872 KB
testcase_16 AC 529 ms
183,848 KB
testcase_17 AC 167 ms
79,992 KB
testcase_18 AC 93 ms
75,904 KB
testcase_19 AC 94 ms
76,032 KB
testcase_20 AC 95 ms
76,416 KB
testcase_21 AC 97 ms
76,160 KB
testcase_22 AC 97 ms
76,288 KB
testcase_23 AC 97 ms
76,160 KB
権限があれば一括ダウンロードができます

ソースコード

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