CF1370A.Maximum GCD

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Maximum GCD

Let's consider all integers in the range from 11 to nn (inclusive).

Among all pairs of distinct integers in this range, find the maximum possible greatest common divisor of integers in pair. Formally, find the maximum value of gcd(a,b)\mathrm{gcd}(a, b), where 1a<bn1 \leq a \lt b \leq n.

The greatest common divisor, gcd(a,b)\mathrm{gcd}(a, b), of two positive integers aa and bb is the biggest integer that is a divisor of both aa and bb.

Input

The first line contains a single integer tt (1t1001 \leq t \leq 100)  — the number of test cases. The description of the test cases follows.

The only line of each test case contains a single integer nn (2n1062 \leq n \leq 10^6).

Output

For each test case, output the maximum value of gcd(a,b)\mathrm{gcd}(a, b) among all 1a<bn1 \leq a \lt b \leq n.

Note

In the first test case, $\mathrm{gcd}(1, 2) = \mathrm{gcd}(2, 3) = \mathrm{gcd}(1, 3) = 1$.

In the second test case, 22 is the maximum possible value, corresponding to gcd(2,4)\mathrm{gcd}(2, 4).

Samples

2
3
5
1
2

在线编程 IDE

建议全屏模式获得最佳体验