結果
問題 |
No.2939 Sigma Popcount Problem
|
ユーザー |
👑 |
提出日時 | 2024-10-19 00:22:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 417 ms / 2,000 ms |
コード長 | 219 bytes |
コンパイル時間 | 374 ms |
コンパイル使用メモリ | 82,776 KB |
実行使用メモリ | 76,512 KB |
最終ジャッジ日時 | 2024-10-19 00:23:03 |
合計ジャッジ時間 | 5,292 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
def solve(n): ans = 0 x = 1 while x <= n: ans += n // (x << 1) * x ans += max(0, n % (x << 1) - x + 1) x <<= 1 print(ans) for _ in range(int(input())): solve(int(input()))