1271: Working Week

内存限制:256 MB 时间限制:1.000 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:4 通过:4 通过率:100%

题目描述

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 l1 ,l2 ,and l3 days long,you want to maximize min( | l1 - l2 |,| l2 - l3 |,| l1 - l3 | ).
Output the maximum value of min( | l1 - l2 |,| l2 - l3 |,| l1 - l3 | ) that can be obtained.

输入格式

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

The only line of each test case contains the integer n (6 ≤ n ≤ 109).

输出格式

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

输入样例 复制

3
6
10
1033

输出样例 复制

0
1
342

数据范围与提示