Codeforces Round 930 (Div. 2)
A
Shuffle Party
Codeforces
800
原题
←B →
翻译中…

You are given an array $a_1, a_2, \ldots, a_n$. Initially, $a_i=i$ for each $1 \le i \le n$.

翻译中…

The operation $\texttt{swap}(k)$ for an integer $k \ge 2$ is defined as follows:

翻译中…
  • Let $d$ be the largest divisor$^\dagger$ of $k$ which is not equal to $k$ itself. Then swap the elements $a_d$ and $a_k$.
翻译中…

Suppose you perform $\texttt{swap}(i)$ for each $i=2,3,\ldots, n$ in this exact order. Find the position of $1$ in the resulting array. In other words, find such $j$ that $a_j = 1$ after performing these operations.

翻译中…

$^\dagger$ An integer $x$ is a divisor of $y$ if there exists an integer $z$ such that $y = x \cdot z$.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

翻译中…

The only line of each test case contains one integer $n$ ($1 \le n \le 10^9$) — the length of the array $a$.

翻译中…

Output

翻译中…

For each test case, output the position of $1$ in the resulting array.

翻译中…

Note

翻译中…

In the first test case, the array is $[1]$ and there are no operations performed.

翻译中…

In the second test case, $a$ changes as follows:

翻译中…
  • Initially, $a$ is $[1,2,3,4]$.
  • After performing $\texttt{swap}(2)$, $a$ changes to $[\underline{2},\underline{1},3,4]$ (the elements being swapped are underlined).
  • After performing $\texttt{swap}(3)$, $a$ changes to $[\underline{3},1,\underline{2},4]$.
  • After performing $\texttt{swap}(4)$, $a$ changes to $[3,\underline{4},2,\underline{1}]$.
翻译中…

Finally, the element $1$ lies on index $4$ (that is, $a_4 = 1$). Thus, the answer is $4$.

翻译中…

样例

Input #1
4
1
4
5
120240229
Output #1
1
4
4
67108864
InputCopy OutputCopy
题目信息
题号
1937A
时间限制
1 s
内存限制
256 MB
标签
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。