CodeTON Round 4 (Div. 1 + Div. 2, Rated, Prizes!)
H
Last Number
Codeforces
2900
原题
← G→
翻译中…

You are given a multiset $S$. Initially, $S = \{1,2,3, \ldots, n\}$.

翻译中…

You will perform the following operation $n-1$ times.

翻译中…
  • Choose the largest number $S_{\text{max}}$ in $S$ and the smallest number $S_{\text{min}}$ in $S$. Remove the two numbers from $S$, and add $S_{\text{max}} - S_{\text{min}}$ into $S$.
翻译中…

It's easy to show that there will be exactly one number left after $n-1$ operations. Output that number.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains a single integer $t$ ($1 \le t \le 10^5$) — the number of test cases. Their description follows.

翻译中…

For each test case, one single line contains a single integer $n$ ($2 \le n \le 10^9$) — the initial size of the multiset $S$.

翻译中…

Output

翻译中…

For each test case, output an integer denoting the only number left after $n-1$ operations.

翻译中…

Note

翻译中…

We show how the multiset $S$ changes for $n=4$.

翻译中…
  • Operation $1$: $S=\{1,2,3,4\}$, remove $4$, $1$, add $3$.
  • Operation $2$: $S=\{2,3,3\}$, remove $3$, $2$, add $1$.
  • Operation $3$: $S=\{1,3\}$, remove $3$, $1$, add $2$.
  • Final: $S = \{2\}$.
翻译中…

Thus, the answer for $n = 4$ is $2$.

翻译中…

样例

Input #1
5
2
4
7
15
177567
Output #1
1
2
2
4
33914
InputCopy OutputCopy
题目信息
题号
1810H
时间限制
2 s
内存限制
256 MB
标签
组合数学
数学

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