题意:一个字符串t的每一个字母进行一次编码,规则为
定义字母数位这个字符在字母表中的顺序。
如果字母数是个位数(小于10),就直接写出来;
如果字母数字是两位数(大于或等于10),则将其写出来并在后面加上数字0。
现在给你转换后的字符串,让你求t。
思路:直接倒着模拟就可以了,记得为0 的时候处理一下下标。
/**
* ┏┓ ┏┓+ +
* ┏┛┻━━━┛┻┓ + +
* ┃ ┃
* ┃ ━ ┃ ++ + + +
* ████━████+
* ◥██◤ ◥██◤ +
* ┃ ┻ ┃
* ┃ ┃ + +
* ┗━┓ ┏━┛
* ┃ ┃ + + + +Code is far away from
* ┃ ┃ + bug with the animal protecting
* ┃ ┗━━━┓ 神兽保佑,代码无bug
* ┃ ┣┓
* ┃ ┏┛
* ┗┓┓┏━┳┓┏┛ + + + +
* ┃┫┫ ┃┫┫
* ┗┻┛ ┗┻┛+ + + +
*/
#include<cstdio>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include<vector>
#include<queue>
#include<map>
#define sc_int(x) scanf("%d", &x)
#define sc_ll(x) scanf("%lld", &x)
#define pr_ll(x) printf("%lld", x)
#define pr_ll_n(x) printf("%lld\n", x)
#define pr_int_n(x) printf("%d\n", x)
#define ll long long
using namespace std;
const int N=1000000+100;
int n ,m,h;
char s[N];
char cnt[N];
int main()
{
int t;
sc_int(t);
while(t--)
{
sc_int(n);
cin>>s+1;
int top=0;
for(int i =n;i>=1;i--)
{
if(s[i]!='0')
cnt[++top]=s[i]-'0'+'a'-1;
else{
i-=1;
cnt[++top]=(s[i]-'0')+(s[i-1]-'0')*10+'a'-1;
i-=1;
}
// cout<<cnt[top]<<" "<<i<<endl;
}
while(top)
cout<<cnt[top--];
cout<<endl;
}
return 0;
}