結果
| 問題 |
No.2939 Sigma Popcount Problem
|
| コンテスト | |
| ユーザー |
keisuke6
|
| 提出日時 | 2024-10-18 21:26:25 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 243 ms / 2,000 ms |
| コード長 | 367 bytes |
| コンパイル時間 | 1,984 ms |
| コンパイル使用メモリ | 192,168 KB |
| 最終ジャッジ日時 | 2025-02-24 20:25:42 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
srand((unsigned)time(NULL));
int T;
cin>>T;
while(T--){
int N;
cin>>N;
N++;
int ans = 0;
for(int i=0;i<41;i++){
int t = (1ll<<(i+1));
ans += N/t*(t/2)+max(0ll,N%t-t/2);
//cout<<ans<<endl;
}
cout<<ans<<endl;
}
}
keisuke6