之前同学上笔试的时候拍下来的,自己随便写了一点,水平较低,仅供参考。
原题:
原题只需要解码,我把编码、解码都写了一下:
#include<iostream>
#include<vector>
using namespace std;
class Youcheng{
public:
//解码
string decode(string & s){
int n=s.size();
vector<string>v;
int i=0;
while(i<n){
if(s[i]=='0'){
v.push_back(s.substr(i,2));//00 push 00 01 push 11
++i;//提前后移
}
int count=1;
whil