結果

問題 No.2939 Sigma Popcount Problem
ユーザー detteiuu
提出日時 2024-10-18 21:28:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 434 ms / 2,000 ms
コード長 250 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 82,440 KB
実行使用メモリ 76,488 KB
最終ジャッジ日時 2024-10-18 22:01:25
合計ジャッジ時間 5,523 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())

for _ in range(T):
    N = int(input())

    ans = 0
    cnt = N.bit_count()
    for i in reversed(range(60)):
        if 1<<i & N:
            if 1 <= i:
                ans += i*(2**i)//2
            ans += N%2**i+1
    print(ans)
0