Codeforces Round 651 (Div. 2)
A
Maximum GCD
Codeforces
800
原题
←B →
翻译中…

Let's consider all integers in the range from $1$ to $n$ (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 $\mathrm{gcd}(a, b)$, where $1 \leq a \lt b \leq n$.

翻译中…

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

翻译中…

Input

翻译中…

The first line contains a single integer $t$ ($1 \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 $n$ ($2 \leq n \leq 10^6$).

翻译中…

Output

翻译中…

For each test case, output the maximum value of $\mathrm{gcd}(a, b)$ among all $1 \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, $2$ is the maximum possible value, corresponding to $\mathrm{gcd}(2, 4)$.

翻译中…

样例

Input #1
2
3
5
Output #1
1
2
InputCopy OutputCopy
题目信息
题号
1370A
时间限制
1 s
内存限制
256 MB
标签
贪心
模拟
数学
数论

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