#include<iostream>
#include<cstring>
using namespace std;
int main()
{
int n;
cin>>n;
while(n--)
{
string str,s;
cin>>str;
int len=str.length();
for(int i=0;i<len;i++)
{
if(str[i]=='0')
s+="0000";
else if(str[i]=='1')
s+="0001";
else if(str[i]=='2')
s+="0010";
else if(str[i]=='3')
s+="0011";
else if(str[i]=='4')
s+="0100";
else if(str[i]=='5')
s+="0101";
else if(str[i]=='6')
s+="0110";
else if(str[i]=='7')
s+="0111";
else if(str[i]=='8')
s+="1000";
else if(str[i]=='9')
s+="1001";
else if(str[i]=='A')
s+="1010";
else if(str[i]=='B')
s+="1011";
else if(str[i]=='C')
s+="1100";
else if(str[i]=='D')
s+="1101";
else if(str[i]=='E')
s+="1110";
else if(str[i]=='F')
s+="1111";
}
cout<<s;
}
return 0;
}
任意进制转化为二进制(暴力解决)
最新推荐文章于 2022-10-17 19:35:40 发布