結果
| 問題 |
No.2939 Sigma Popcount Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-18 22:10:13 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 573 ms / 2,000 ms |
| コード長 | 192 bytes |
| コンパイル時間 | 510 ms |
| コンパイル使用メモリ | 82,452 KB |
| 実行使用メモリ | 76,428 KB |
| 最終ジャッジ日時 | 2024-10-18 22:47:19 |
| 合計ジャッジ時間 | 6,295 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
T=int(input())
for _ in range(T):
N=int(input())
ans=0
L=len(bin(N)[2:])
for i in range(1,L+1):
ans+=N//(1<<i)*(1<<(i-1))+max(0,(N%(1<<i)+1)-(1<<(i-1)))
print(ans)