#include <iostream> #include <cstdio> #include <cstdlib> #include <vector> #include <map> using namespace std; struct node{ char a,b; node(char _a,char _b){ this->a=_a; this->b=_b; } }; vector<node> data; map<char,char> m; void VEC(){ data.push_back(node('A','A')); data.push_back(node('E','3')); data.push_back(node('H','H')); data.push_back(node('I','I')); data.push_back(node('J','L')); data.push_back(node('L','J')); data.push_back(node('M','M')); data.push_back(node('O','O')); data.push_back(node('S','2')); data.push_back(node('T','T')); data.push_back(node('U','U')); data.push_back(node('V','V')); data.push_back(node('W','W')); data.push_back(node('X','X')); data.push_back(node('Y','Y')); data.push_back(node('Z','5')); data.push_back(node('1','1')); data.push_back(node('2','S')); data.push_back(node('3','E')); data.push_back(node('5','Z')); data.push_back(node('8','8')); } void MAP(){ m['A']='A'; m['E']='3'; m['H']='H'; m['I']='I'; m['J']='L'; m['L']='J'; m['M']='M'; m['O']='O'; m['S']='2'; m['T']='T'; m['U']='U'; m['V']='V'; m['W']='W'; m['X']='X'; m['Z']='5'; m['1']='1'; m['2']='S'; m['3']='E'; m['5']='Z'; m['8']='8'; } char A[]={'A','b','c','d','3','f','g','H','I','L','k','J','M', 'n','O','p','q','r','2','T','U','V','W','X','Y','5'}; char B[]={'1','S','E','0','Z','0','0','8','0'}; bool isBig(char x){ if(x>='A'&&x<='Z') return true; return false; } bool isSmall(char x){ if(x>='a'&&x<='z') return true; return false; } bool isDigit(char x){ if(x>='1'&&x<='9') return true; return false; } char c; const int maxn=100; char s[maxn]; int main(){ return 0; }
应该可以看出来最后一个编码量最小。。但是对于中间不存在映射关系的元素我们可以用其他标志来特判没有。。
不要自己硬数。。。费眼费力啊。。这个题好像小写字母和0是非法的。。所以我们可以用来特判
但是最后一个存法会慢一些?线性的嘛。。
map和vector应该会快一些。。毕竟是红黑树和块状链表。。但是这个毕竟是数据量有点大的情况
数据量小的话我们尽量采用最后一种存储方式