結果

問題 No.2939 Sigma Popcount Problem
ユーザー amesyu
提出日時 2024-10-24 11:10:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 497 ms / 2,000 ms
コード長 202 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 82,576 KB
実行使用メモリ 76,396 KB
最終ジャッジ日時 2024-10-24 11:10:50
合計ジャッジ時間 7,873 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())

x = 40
for _ in range(t):
    n = int(input()) + 1
    ans = 0
    for i in range(x):
        p = 2 ** (i + 1)
        ans += (n//p)*p//2
        ans += max(0,n%p-p//2)
    print(ans)
0