直接打表。。把相应字符转换成ASC||
这题今晚做的可纠结了。。光初始化就很伤眼睛,A之后眼睛应该定格了吧,
代码:
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<stack>
#include<map>
#include<queue>
#include<vector>
using namespace std;
string tb[20][20];
char a[5555555];
void ff()
{
tb[0][0] = "00";//用下标代表那个字符串,“00”代表ASC||
tb[0][1] = "01";
tb[0][2] = "02";
tb[0][3] = "03";
tb[0][5] = "09";
tb[0][7] = "7F" ;
tb[0][11] = "0B";
tb[0][12] = "0C";
tb[0][13] = "0D";
tb[0][14] = "0E";
tb[0][15] = "0F";
tb[1][0] = "10";
tb[1][1] = "11";
tb[1][2] = "12";
tb[1][3] = "13";
tb[1][6]="08";
tb[1][8]="18";
tb[1][9]="19";
tb[1][12]="1C";
tb[1][13]="1D";
tb[1][14]="1E";
tb[1][15]="1F" ;
tb[2][5]="0A";
tb[2][6]="17";
tb[2][7]="1B" ;
tb[2][13]="05";
tb[2][14]="06";
tb[2][15]="07";
tb[3][2]= "16";
tb[3][7]= "04";
tb[3][12]="14";
tb[3][13]="15";
tb[3][15]="1A";
tb[4][0] ="20";
tb[4][11]="2E";
tb[4][12]="3C";
tb[4][13]="28";
tb[4][14]="2B";
tb[4][15]="7C";
tb[5][0]="26";
tb[5][10]="21";
tb[5][11]="24";
tb[5][12]="2A";
tb[5][13]="29";
tb[5][14]="3B";
tb[6][0]="2D";
tb[6][1]="2F";
tb[6][11]="2C";
tb[6][12]="25";
tb[6][13]="5F";
tb[6][14]="3E";
tb[6][15]="3F";
tb[7][9]="60";
tb[7][10]="3A";
tb[7][11]="23";
tb[7][12]="40";
tb[7][13]="27";
tb[7][14]="3D";
tb[7][15]="22";
tb[8][1] = "61";
tb[8][2] = "62";
tb[8][3] = "63";
tb[8][4] = "64";
tb[8][5] = "65";
tb[8][6] = "66";
tb[8][7] = "67";
tb[8][8] = "68";
tb[8][9] = "69";
tb[9][1] = "6A";
tb[9][2] = "6B";
tb[9][3] = "6C";
tb[9][4] = "6D";
tb[9][5] = "6E";
tb[9][6] = "6F";
tb[9][7] = "70";
tb[9][8] = "71";
tb[9][9] = "72";
tb[10][1] = "7E";
tb[10][2] = "73";
tb[10][3] = "74";
tb[10][4] = "75";
tb[10][5] = "76";
tb[10][6] = "77";
tb[10][7] = "78";
tb[10][8] = "79";
tb[10][9] = "7A";
tb[11][0] = "5E";
tb[11][10] = "5B";
tb[11][11] = "5D";
tb[12][0] = "7B";
tb[12][1] = "41";
tb[12][2] = "42";
tb[12][3] = "43";
tb[12][4] = "44";
tb[12][5] = "45";
tb[12][6] = "46";
tb[12][7] = "47";
tb[12][8] = "48";
tb[12][9] = "49";
tb[13][0] = "7D";
tb[13][1] = "4A";
tb[13][2] = "4B";
tb[13][3] = "4C";
tb[13][4] = "4D";
tb[13][5] = "4E";
tb[13][6] = "4F";
tb[13][7] = "50";
tb[13][8] = "51";
tb[13][9] = "52";
tb[14][0] = "5C" ;
tb[14][2] = "53";
tb[14][3] = "54";
tb[14][4] = "55";
tb[14][5] = "56";
tb[14][6] = "57";
tb[14][7] = "58";
tb[14][8] = "59";
tb[14][9] = "5A";
tb[15][0] = "30";
tb[15][1] = "31";
tb[15][2] = "32";
tb[15][3] = "33";
tb[15][4] = "34";
tb[15][5] = "35";
tb[15][6] = "36";
tb[15][7] = "37";
tb[15][8] = "38";
tb[15][9] = "39";
}
int main()
{
ff();
scanf("%s",a);
int len = strlen(a),x,y;
for(int i=0; i<len; i+=2)
{
if(a[i] >= 'A' && a[i] <='F') x = a[i] - 'A' + 10;
else x = a[i] - '0';
if(a[i+1] >= 'A' && a[i+1] <='F') y = a[i+1] - 'A' + 10;
else y = a[i+1] - '0';
cout <<tb[x][y];
}
puts("");
return 0;
}