解题思路:
注意事项:
参考代码:
#include<stdio.h>
unsigned int value;
int n,i,N;
unsigned int move(unsigned int value,int n)
{
if(n>0)
{
while(n!=0)
{
i=value%2;
value=value>>1;
if(i==1)
{
value|=0x80000000;
}
n--;
}
}
else if(n<0)
{
N=-n;
while(N!=0)
{
i=value&0b10000000000000000000000000000000;
value=value<<1;
if(i==0b10000000000000000000000000000000)
{
value|=0b000000000000000000000000000001;
}
N--;
}
}
return printf("%u\n",value);
}
int main()
{
scanf("%u%d",&value,&n);
move(value,n);
return 0;
}
0.0分
0 人评分