#K59192. Shortest Thue-Morse String Length
Shortest Thue-Morse String Length
Shortest Thue-Morse String Length
In this problem, you are given an integer ( n ) (with ( 1 \le n \le 10^5 )). The task is to determine the length of the shortest Thue-Morse string that can be constructed such that its length is at least ( n ). The Thue-Morse string is generated iteratively where starting with "0", each subsequent iteration appends the binary complement of the string so far. Notice that the length of the Thue-Morse string is always a power of 2. Therefore, the answer is simply the smallest power of ( 2 ) that is greater than or equal to ( n ).
inputFormat
The input consists of a single integer ( n ) provided via standard input.
outputFormat
Output the length of the shortest Thue-Morse string (a power of 2) that is at least ( n ), via standard output.## sample
1
1