shunfurh 于 2017.09.12 00:06 提问
- Big String
We will construct an infinitely long string from two short strings: A = "^__^" (four characters), and B = "T.T" (three characters). Repeat the following steps:
Concatenate A after B to obtain a new string C. For example, if A = "^__^" and B = "T.T", then C = BA = "T.T^__^".
Let A = B, B = C -- as the example above A = "T.T", B = "T.T^__^".
Your task is to find out the n-th character of this infinite string.
The input contains multiple test cases, each contains only one integer N (1 <= N <= 2^63 - 1). Proceed to the end of file.
For each test case, print one character on each line, which is the N-th (index begins with 1) character of this infinite string.
- caozhy 2017.09.13 00:46
- shen_wei 2017.09.12 16:12