文章
36
粉丝
0
获赞
5
访问
22.0k
#include <stdio.h>
#include <stdbool.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
int main(){
int n,s[32],j=31,temp[4],count=0,sum=0;
for(int i=0;i<32;i++) s[i] = 0;
scanf("%d",&n);
while(n>0){
s[j--] = n%2;
n /= 2;
}
temp[0] = s[4];
temp[1] = s[5];
temp[2] = s[6];
temp[3] = s[7];
s[4] = s[12];
s[5] = s[13];
s[6] = s[14];
s[7] = s[15];
s[12] = s[20];
s[13] = s[21];
s[14] = s[22];
s[15] = s[23];
s[20] = s[28];
s[21] = s[29];
s[22] = s[30];
s[23] = s[31];
s[28] = temp[0];
s[29] = temp[1];
s[30] = temp[2];
s[31] = temp[3];
for(int i=31;i>=0;i--){
sum += pow(2,count++)*s[i];
}
printf("%d",sum);
return 0;
}
登录后发布评论
暂无评论,来抢沙发