#P16502. [GKS 2015 #A] Googol String
[GKS 2015 #A] Googol String
题目描述
A "0/1 string" is a string in which every character is either 0 or 1. There are two operations that can be performed on a 0/1 string:
- switch: Every 0 becomes 1 and every 1 becomes 0. For example, "100" becomes "011".
- reverse: The string is reversed. For example, "100" becomes "001".
Consider this infinite sequence of 0/1 strings:
...
$S_N = S_{N-1} + ``0" + \textbf{switch}(\textbf{reverse}(S_{N-1}))$.
You need to figure out the Kth character of , where googol = .
输入格式
The first line of the input gives the number of test cases, . Each of the next lines contains a number .
输出格式
For each test case, output one line containing "Case #x: ", where is the test case number (starting from ) and is the Kth character of .
4
1
2
3
10
Case #1: 0
Case #2: 0
Case #3: 1
Case #4: 0
提示
Limits
.
Small dataset (Test Set 1 - Visible)
.
Large dataset (Test Set 2 - Hidden)
.