結果
問題 | No.2939 Sigma Popcount Problem |
ユーザー |
|
提出日時 | 2024-10-18 21:24:47 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 88 ms / 2,000 ms |
コード長 | 408 bytes |
コンパイル時間 | 1,937 ms |
コンパイル使用メモリ | 192,612 KB |
最終ジャッジ日時 | 2025-02-24 20:24:00 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while(T--){ long long N; cin >> N; long long answer = 0; for(int i=0; i<50; i++){ answer += N/(1LL<<(i+1))*(1LL<<i); answer += max(0LL,N%(1LL<<(i+1))-(1LL<<i)+1); } cout << answer << "\n"; } }