题目链接
http://codeforces.com/problemset/problem/896/Acsrf_token=2d70d2ab176389681e17947374617961
有意思的搜索,有关于柯朵莉的
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int INF = ( 2e9 ) + 2;
const int maxn = 1e5+10;
char t1[] = "What are you doing while sending \"";
char t2[] = "\"? Are you busy? Will you send \"";
char t3[] = "\"?";
char t0[] = "What are you doing at the end of the world? Are you busy? Will you save us?";
int l1,l2,l3,l0;
ll len[maxn];
int index;
void init()
{
index=0;
l0=strlen(t0);
l1=strlen(t1);
l2=strlen(t2);
l3=strlen(t3);
len[index++] = l0;
while(len[index-1]<=1e18)
{
len[index] = l1 + len[index-1] + l2 + len[index-1] + l3;
index++;
}
for(int i=index;i<=1e5+1;i++)
len[i] = 1e18+1;
}
char dfs(int n,ll k)
{
if(k>len[n])return '.';
else
{
if(n==0)
return t0[k-1];
else
{
if(k<=l1)return t1[k-1];
k-=l1;
if(k<=len[n-1])
return dfs(n-1,k);
k-=len[n-1];
if(k<=l2)return t2[k-1];
k-=l2;
if(k<=len[n-1])
return dfs(n-1,k);
k-=len[n-1];
if(k<=l3)return t3[k-1];
k-=l3;
}
}
}
int main()
{
init();
int q;
scanf("%d",&q);
int n;ll k;
while(q--)
{
scanf("%d%I64d",&n,&k);
printf("%c",dfs(n,k));
}
}