代码:
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 1e5+10;
const LL INF = 2e18;
LL len[N];
string s="DKER EPH VOS GOLNJ ER RKH HNG OI RKH UOPMGB CPH VOS FSQVB DLMM VOS QETH SQB";
string a="DKER EPH VOS GOLNJ UKLMH QHNGLNJ A";
string b="AB CPH VOS FSQVB DLMM VOS QHNG A";
string c="AB";
char f(int n,LL k){
if(k > len[n])
return '.';
if(n == 0){
return s[k-1];
}else{
if(k<=a.size()){
return a[k-1];
}
k -= a.size();
if(k <= len[n-1]){
return f(n-1,k);
}
k -= len[n-1];
if(k <= b.size()){
return b[k-1];
}
k -= b.size();
if(k <= len[n-1]){
return f(n-1,k);
}
k -= len[n-1];
return c[k-1];
}
}
int main()
{
len[0] = s.size();
for(int i=1;i<N;i++){
len[i]=len[i-1]*2+a.size()+b.size()+c.size();
len[i] = min(len[i],INF);
}
int q;
cin>>q;
while(q--){
int n;
LL k;
cin>>n>>k;
cout<<f(n,k);
}
return 0;
}