DMOPC '19 Contest 1 P2 - Good Writing

View as PDF

Submit solution


Points: 7
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

A teacher once said: "Good writing is good writing is good writing."
Hence, the teacher defines f0= "Good writing is good writing is good writing."
To make the quote more interesting the teacher defines fn= "Good writing is good " +fn1+ " writing is good " +fn1+ " is good writing." for all n1.

For example, f1 is

Copy
Good writing is good Good writing is good writing is good writing. writing is good Good writing is good writing is good writing. is good writing.

Note that the quotation marks are not part of f1.

The teacher wants to ask q questions. Each time she wants to find the kth character of fn.
Characters are indexed starting at 1. If fn consists of less than k characters, output ..

Constraints

1q10
0n30
1k2311

Input Specification

The first line contains an integer, q.
The following q lines each contains two integers, n and k in that order.

Output Specification

On the ith line, output the answer to the ith question.

Sample Input 1

Copy
3
0 4
1 100
1 1111111

Sample Output 1

Copy
d
g
.

Sample Input 2

Copy
3
0 6
1 13
1 22

Sample Output 2

Copy
w
 
G

Comments


  • 4
    Kirito  commented on July 19, 2020, 6:13 p.m.

    I see you guys still haven't gotten over

    What Do You Do at the End of the World? Are You Busy? Will You Save Us?


    • 2
      Tzak  commented on July 19, 2020, 9:20 p.m.

      bro are you alright