#include<bits/stdc++.h> using namespace std; int main(){ int a; cin>>a; cout<<__lg(a)+__builtin_popcount(a)-1; return 0; }
时间复杂度应该是 O(logn)O(\log n)O(logn)?