CF1370A.Maximum GCD

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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

输入格式

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

输出格式

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

输入输出样例

  • 输入#1

    2
    3
    5

    输出#1

    1
    2

说明/提示

In the first test case, gcd(1,2)=gcd(2,3)=gcd(1,3)=1\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) .

首页