#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <bitset>
using namespace std;
int main(){
int n;
cin>>n;
string str = bitset<8>(n).to_string(); //从前往后是0到n位
reverse(str.begin(), str.end());
int x = (str[3]-'0')*8 + (str[2]-'0')*4 + (str[1]-'0')*2 + (str[0]-'0');
int y = (str[7]-'0')*8 + (str[6]-'0')*4 + (str[5]-'0')*2 + (str[4]-'0');
if(y) cout<<y<<x;
else cout<<x;
return 0;
}
7-4 BCD解密 (10 分)
最新推荐文章于 2024-08-07 11:02:34 发布