题库练习 Working Week
← 上一题 下一题 →

A15440 | Working Week

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

题目描述

Your working week consists of $n$ days numbered from $1$ to $n$ , after day $n$ goes day $1$ again. And $3$ of them are days off. One of the days off is the last day, day $n$ . You have to decide when the other two are.

Choosing days off, you pursue two goals:

- No two days should go one after the other. Note that you can't make day $1$ a day off because it follows day $n$ .
- Working segments framed by days off should be as dissimilar as possible in duration. More specifically, if the segments are of size $l_1$ , $l_2$ , and $l_3$ days long, you want to maximize $\min(|l_1 - l_2|, |l_2 - l_3|, |l_3 - l_1|)$ .

Output the maximum value of $\min(|l_1 - l_2|, |l_2 - l_3|, |l_3 - l_1|)$ that can be obtained.

输入格式

The first line of the input contains a single integer $t$ ( $1 \le t \le 1000$ ) — the number of test cases. The description of test cases follows.

The only line of each test case contains the integer $n$ ( $6 \le n \le 10^9$ ).

输出格式

For each test case, output one integer — the maximum possible obtained value.

输入输出样例

输入 #1
3
6
10
1033
输出 #1
0
1
342
C++ 编辑器
输入
输出