NOJ/32/main.c
Saturneric 52668c4122 Add.
2020-09-01 00:46:43 +08:00

24 lines
369 B
C

#include <stdio.h>
int main(void){
int value;
int n,temp,i,k;
scanf("%d %d",&value,&n);
for(i = (n>0)?n:-(n); i > 0; i--){
if(n < 0){
temp = value & 2147483648;
value <<= 1;
if(temp == -2147483648)
value += 1;
}
else if(n > 0){
temp = value & 1;
value >>= 1;
if(temp)
value += 2147483648;
}
}
printf("%d\n",value);
return 0;
}