Codeforces 896A
来源:互联网 发布:淘宝白内障器械 编辑:程序博客网 时间:2024/06/03 21:13
/** 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 57and the max number in long long type is 9223372036854775807 (19 digit,2^63)f0 75 = 75f1 34 75 32 75 2 = 218f2 34 218 32 218 2 = 504*/
阅读全文
0 0
- Codeforces 896A
- codeforces 896A dfs
- CodeForces-a
- Codeforces 903A A
- codeforces 896A Nephren gives a riddle dfs搜索
- CodeForces 18A A - Triangle
- CodeForces 133A A. HQ9+
- codeforces 651A A. Joysticks
- 【Codeforces 597A】A. Divisibility
- 【 Codeforces 615A】A. Bulbs
- A. Divisibility CodeForces 597A
- codeforces 417A A. Elimination
- CodeForces 534A A. Exam
- codeforces#98 a
- codeforces#99 a
- codeforces 105 div2 A
- codeforces #121 A
- Codeforces 185A Plant
- vue-cli搭建中遇到的chromedriver安装失败问题解决
- 如何在局域网内设置多个网段
- 数字三角形
- 互联网公司常见面试算法题
- 十一行Python代码实现一个误差逆传播(BP)神经网络
- Codeforces 896A
- django 用ajax+post提交form 实现前后台数据绑定
- log4j输出多个自定义日志文件
- Hello Kitty!
- POJ2479:Maximum sum
- SpringBoot小白教程 (一): 使用Maven新建SpringBoot工程
- QML Image动态刷新图片来自C++的QImage的一个巨坑
- Unable to complete the scan for annotations for web application [] due to a StackOverflowError
- samba共享存储服务