結果
問題 |
No.2939 Sigma Popcount Problem
|
ユーザー |
|
提出日時 | 2024-10-18 23:59:44 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 219 ms / 2,000 ms |
コード長 | 508 bytes |
コンパイル時間 | 5,038 ms |
コンパイル使用メモリ | 308,956 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-19 00:01:20 |
合計ジャッジ時間 | 8,095 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using ll = long long; using ld = long double; using mint = atcoder::modint1000000007; const ll inf = 9e18; int main(){ ios::sync_with_stdio(0); cin.tie(0); ll t; cin >> t; for(ll i=0;i<t;i++){ ll n; cin >> n; ll ans=0; for(ll b=0;b<60;b++){ ans+=(n/(1ll<<(b+1)))*(1ll<<b); ans+=max(0ll,n%(1ll<<(b+1))-(1ll<<b)+1); } cout << ans << endl; } }