結果

問題 No.2939 Sigma Popcount Problem
ユーザー tassei903tassei903
提出日時 2024-10-18 21:28:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 613 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 76,824 KB
最終ジャッジ日時 2024-10-18 22:01:47
合計ジャッジ時間 4,055 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,496 KB
testcase_01 AC 35 ms
53,096 KB
testcase_02 AC 36 ms
52,196 KB
testcase_03 AC 36 ms
54,156 KB
testcase_04 AC 36 ms
53,012 KB
testcase_05 AC 37 ms
52,120 KB
testcase_06 AC 36 ms
52,948 KB
testcase_07 AC 36 ms
53,232 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 235 ms
76,556 KB
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################


for _ in range(ni()):
    n = ni()
    ans = 0
    for k in range(20):
        x = n // (2 ** (k + 1))
        ans += x * (2 ** k) + max(n % (2 ** (k + 1)) - 2 ** k + 1, 0)
        # print(k, x * (2 ** k) + max(n % (2 ** (k + 1)) - 2 ** k, 0))
    print(ans)
0