結果

問題 No.2067 ±2^k operations
ユーザー とりゐとりゐ
提出日時 2022-08-25 21:54:23
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 226 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 92,800 KB
最終ジャッジ日時 2024-04-23 19:16:20
合計ジャッジ時間 3,664 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
76,160 KB
testcase_01 AC 120 ms
92,544 KB
testcase_02 AC 119 ms
92,288 KB
testcase_03 AC 125 ms
92,288 KB
testcase_04 AC 121 ms
92,800 KB
testcase_05 AC 121 ms
92,544 KB
testcase_06 AC 116 ms
92,544 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 126 ms
92,544 KB
testcase_20 AC 121 ms
92,544 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=1<<20

dp=[0]*n
cum=[0]*n
dp[1]=1
cum[1]=1
for i in range(2,n):
  if i%2==0:
    dp[i]=dp[i//2]
  else:
    dp[i]=1+min(dp[i//2],dp[(i+1)//2])
  cum[i]=dp[i]+cum[i-1]

for _ in range(int(input())):
  print(cum[int(input())])
0