/*
* 20171205
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
char F[] = "What are you doing at the end of the world? Are you busy? Will you save us?";
char A[] = "What are you doing while sending \"";
char B[] = "\"? Are you busy? Will you send \"";
char C[] = "\"?";
const long long FL = strlen(F);
const long long AL = strlen(A);
const long long BL = strlen(B);
const long long CL = strlen(C);
const long long ALL = FL+AL+BL+CL;
char solve(long long a,long long b)
{
if(a==0)
{
if(b>FL) return '.';
else return F[(b-1)%FL];
}
if(b<=AL) return A[(b-1)%AL];
if(a>=57) return solve(a-1,b-AL);
long long lastL = 1;
lastL<<=(a-1);
lastL*=ALL;
lastL-=(AL+BL+CL);
if(b<=AL) return A[(b-1)%AL];
b-=AL;
if(b<=lastL) return solve(a-1,b);
b-=lastL;
if(b<=BL) return B[(b-1)%BL];
b-=BL;
if(b<=lastL) return solve(a-1,b);
b-=lastL;
if(b<=CL) return C[(b-1)%CL];
return '.';
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
long long n,m;
scanf("%I64d%I64d",&n,&m);
printf("%c",solve(n,m));
}
printf("\n");
return 0;
}
/*
the length of fn is f0*2^n+(A+B+C)*(2^n-1),is (f0+A+B+C)*2^n-(A+B+C);
the length of fn-1 is (f0+A+B+C)*2^(n-1)-(A+B+C);
and the max of k is 10^18 about 2^60,so the max of n strictly less than 57
and the max number in long long type is 9223372036854775807 (19 digit,2^63)
f0 75 = 75
f1 34 75 32 75 2 = 218
f2 34 218 32 218 2 = 504
*/
相关推荐
奇安信 2025 年护网蓝队初选笔试题(附答案解析)
熬夜为大家整理了 奇安信 2025 年护网蓝队初选笔试题,(关注我我会持续更新)涵盖 SQL 注入、Web 安全、渗透测试、二进制安全 等核心知识点,并附上详细答案解析,助力大家高效备考!12.下列关于虚表指针描述正确的是(1.5分)✅ B. 虚表指针存储的是虚表的首地址❌ A. 任何类对象都存在虚表指针(仅含虚函数的类有)❌ C. 虚表指针位于对象内存空间的起始处(由编译器决定)❌ D. 虚表指针是否存在不影响对象所占内存空间的大小(存在时会增加指针大小)📌 解析:虚表指针(vptr)用于实现多态,指向
Codeforces 896C 珂朵莉树
题意 传送门 Codeforces 896C 题解 对于区间操作类型随机且包含区间赋值操作,同时数据随机的数据结构题,可以考虑应用珂朵莉树进行求解。使用 std::set\text{std::set}std::set 实现,初始化时将各元素依次插入,时间复杂度为 O(NlogN)O(N\log N)O(NlogN);其余操作总时间复杂度 O(NloglogN)O(N\log\log N)O(NloglogN)。 #include <bits/stdc++.h> using namespac
CH340以及CH系列USB转串口驱动下载
在之前使用USB转串口时,很多时候大家可能会不知道去哪下载驱动,然后百度随便下载一个,但往往鱼龙混杂且版本不一,所以今天特意整理一下CH340驱动以及CH系列的官方驱动下载地址,方便大家进行下载也方便自己后期查找,所有链接皆指向官方下载链接,每次下载都可获取官方当前最新驱动。 CH340/CH341 Windows驱动下载链接:CH341SER.EXE下载链接 Linux驱动下载链接:CH341SER_LINUX.ZIP下载链接 Andr...
codeforces 896C
由于是随机数生成,所以可以用map或者set的平衡树维护。 对于各类操作,暴力即可(看了题解,一口老血吐出来) 注意操作2是,删除后合并即可。 注意如果数在某个区间内,直接map tree[A] = B ,即new了该结点, 还有注意upper_bound,和lower_bound返回的指针。 #include using namespace std; typede
Starlink第三代终端和第二代终端的差异性有哪些?
starlink第三代终端和第二代终端的额差异
[ 数论 ] Codeforces896D
枚举VIP的个数 xx,求出第一种人个数的范围 [L,R][L,R]。 用类似求卡特兰数的方法可以求出答案为 (nx)∑i=LR(n−xi)−(n−xi+1){n\choose x}\sum_{i=L}^R {n-x\choose i}-{n-x\choose i+1} 即 (nx)⋅(n−xL)−(nx)⋅(n−xR+1){n\choose x}·{n-x\choose L}-{n\cho
matlab电偶极子源码,电偶极子的MATLAB场模拟
电偶极子周围电场电势分布的MATLAB三维模拟Matlab可以用于模拟四维场的效果,本文以电偶极子的电场和电势场为例展示MATLAB在该方面领域的应用。摘要电偶极子由一个正电荷和一个负电荷组成,其电场和空间电势分布与单电荷相比具有一些重要的特性。本文将给出电场和电势场的近似表达式。这两个量的精确表达式是复杂的,不太常用,因此 MATLAB 被采用来操作精确值和绘制三维分布的远区域, 近区域和一侧区...
Codeforces Round #449 (Div. 1) A. Nephren gives a riddle 模拟.
A. Nephren gives a riddle time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output What are you doing at the end of the world? Are you busy
【AIGC】大模型面试高频考点07-注意力(Attention)篇
AIGC面试高频考点
使用 MATLAB/Simulink 构建一个多时间尺度下的微电网经济运行优化策略模型
本文介绍了基于Simulink的多能互补微电网系统建模方法,重点关注多时间尺度下的经济运行优化策略。内容包括:系统背景与目标、微电网结构设计(光伏、风电、储能、柴油发电机等模块)、多时间尺度能量管理架构(日前优化、日内滚动优化、实时控制)的实现步骤,以及仿真运行与结果分析。教程详细说明了如何在Simulink中调用优化算法,设置仿真参数,并提供了进阶研究方向和资源推荐。该模型为研究微电网的经济运行和智能调度提供了完整的仿真平台解决方案。
codeforces896A Nephren gives a riddle (dfs)
题目链接:http://codeforces.com/problemset/problem/896/A 题意:给你一个数字n,代表f(n),然后给定数字k,在f(n)中查找第k个字符,如果k > f(n)的长度,返回‘.’; 思路:在f(n)中找到f(n-1)处,递归查找即可 #include #define LL long long using namespace std; char
【赛题解析&命令脚本配置】2024年第十七届山东省技能大赛 | 网络系统管理”赛项-模块B:Linux服务部署 & ⑤客户端OutsideCli和InsideCli工作任务
【赛题解析&命令脚本配置】2024年第十七届山东省技能大赛 | 网络系统管理”赛项-模块B:Linux服务部署 & ⑤客户端OutsideCli和InsideCli工作任务 | 【赛题解析&命令脚本配置】2024年第十七届山东省技能大赛 | 网络系统管理”赛项-模块B:Linux服务部署 & ⑤客户端OutsideCli和InsideCli工作任务
Codeforces 896A Nephren gives a riddle(模拟递归)
Codeforces 896A Nephren gives a riddle(模拟递归) 题意 一个初始字符串f0f_0f0 What are you doing at the end of the world? Are you busy? Will you save us? 然后开始递归复读 What are you doing while sending “What are you d...
精雕软件(JDpaint) 5.5 绿色版
精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版
visio安装包
Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。
codeforces 896A dfs
Nephren gives a riddle 题目要求在一个无限迭代的字符串中在第n层找到第k个字母。 f(x) = sb + f(x - 1) + sc + f(x - 1) + sd 预处理出不超过范围的最大层。则下一层大于这一层的两倍。 dfs 如果在预处理层之内,且k大于该层长度,则返回 ‘.’ 如果在第0层,返回原串位置 如果在sb之内,返回sb的字母 如果在
Statistics and Machine Learning Toolbox
Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具
Codeforces896A Nephren gives a riddle
题意 字符串f0是"What are you doing at the end of the world? Are you busy? Will you save us?"。 字符串 fi 是 "What are you doing while sending "fi - 1"? Are you busy? Will you send "fi - 1"?" 。 先输入q(1
lwip-2.0.3
lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。
codeforces 896A Nephren gives a riddle dfs搜索
题目链接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
Codeforces896A Nephren gives a riddle
标签:dfs题目题面传送门What are you doing at the end of the world? Are you busy? Will you save us?Nephren is playing a game with little leprechauns.She gives them an infinite array of strings, f0… ∞.f0 is “What
codeforces896A Nephren gives a riddle
A. Nephren gives a riddle time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output What are you doing at the end of the wo...
P5017摆渡车:从DP设计到时间轴压缩优化全解析
动态规划是算法竞赛中核心的解决问题思想之一,其关键在于状态定义与转移优化。在求解区间等待时间最小化一类问题时,常常需要借助前缀和实现O(1)代价计算,并结合题目隐含的间隔性质压缩状态空间。本文以NOIP 2018普及组T4“摆渡车”为例,展示从朴素DP到可AC解法的完整推导过程,重点讲解如何发现相邻发车间隔不超过2m的性质,从而将时间轴从极大范围压缩至1e5级别,并最终实现O(T×m)的高效算法。这种先寻找性质再优化状态的思维路径,广泛适用于各类调度类动态规划题目,对备赛CSP-J/NOIP的学生和算法爱好
Codeforces--896A--The Artful Expedient
题目描述: Rock… Paper! After Karen have found the deterministic winning (losing?) strategy for rock-paper-scissors, her brother, Koyomi, comes up with a new game as a substitute. The game works as follows...
Codeforces Round 896 (Div. 2) 题解 A-C
Codeforces Round 896 (Div. 2) 题解 A-B,数学,异或运算,思维,分类讨论,构造
CodeForces 896D Nephren Runs a Cinema(组合计数+数论+数形结合)
非常巧妙的一道综合数学题…… 大致题意:电影院有三种方式买票,要么花五十元买票进去,要么用卡不用钱,要么给一百元然后找五十元。然后一开始卖票的人没有钱找,然后问你总共有多少种方案,可以使得卖票的人不会出现没钱可找,且最后剩余的50元钱的张数在区间[l,r]之间。 首先,我们考虑简化版的问题,先不考虑用卡消费的方式,而且最后剩余的五十元钱张数为0。在这种情况下,依稀记得哪个学长讲过,对应可以转化到坐标轴上,人初始时在原点。然后五十元的相当于向前向上走一个单位,然后一百元对应向前
Nephren Runs a Cinema CodeForces - 896D(卡特兰数,模数非质数求组合数)
Lakhesh loves to make movies, so Nephren helps her run a cinema. We may call it No. 68 Cinema. However, one day, the No. 68 Cinema runs out of changes (they don’t have 50-yuan notes currently), but Ne...
Codeforces Round 896(Div.2)
初次发博客,菜勿喷
Codeforces Round 896
Codeforces Round 896
4704



被折叠的 条评论
为什么被折叠?



