题库练习 Last Number
← 上一题 下一题 →

A15780 | Last Number

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

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.

输入格式

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$ .

输出格式

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

输入输出样例

输入 #1
5
2
4
7
15
177567
输出 #1
1
2
2
4
33914
C++ 编辑器
输入
输出