class Solution {
public:
string baseNeg2(int n)
{
if(n == 0) return to_string(n);
string ans;
while(n)
{
int t = n & 1; // int t = n % -2; 在 C++ 里面结果数负数用不了
ans += to_string(t);
n = (n - t) / (-2);
}
reverse(ans.begin(), ans.end());
return ans;
}
};