int binMirror(int x){
int temp=0, t=x; //temp用于记录x的最后一位数(0或者1)
for(int i = 0;i<32; i++){
temp*= 2;
temp+= x%2;
x>>=1; //记录完后x往后移一位
}
if(t<0) //t用于记录x的符号
{
return -temp;
}
return temp;
};
12-13
2155
11-15
1883
05-18
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交