(x\%2^{w+1})一共有(2^{w+1})情况,
- ([0,2^w)),(w)位为(0)
- ([2^w, 2^{w+1})), (w)位为(1)
那么在(w)为上为(1)的情况有(2^w)种,$$ans =x/2^{w+1} * 2^w + max(x%2^{w+1} -2^w+1, 0)$$
ll get(ll x, ll w){
ll tmp = 1ll<<w;
ll ans = x / (tmp * 2) * tmp + max(x % (tmp*2) - tmp + 1 , 0ll);
return ans;
}