Maximum GCD

A. Maximum GCD

Problem

Let’s consider all integers in the range from 1 1 1 to n n 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 g c d ( a , b ) \mathrm{gcd}(a, b) gcd(a,b), where KaTeX parse error: Expected 'EOF', got '&' at position 10: 1 \leq a &̲lt; b \leq n.

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

Input

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

The only line of each test case contains a single integer n n n ( 2 ≤ n ≤ 1 0 6 2 \leq n \leq 10^6 2n106).

Output

For each test case, output the maximum value of g c d ( a , b ) \mathrm{gcd}(a, b) gcd(a,b) among all KaTeX parse error: Expected 'EOF', got '&' at position 10: 1 \leq a &̲lt; b \leq n.

Example

Input
2
3
5
Output
1
2

Note

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

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

Code

// #include <iostream>
// #include <algorithm>
// #include <cstring>
// #include <stack>//栈
// #include <deque>//堆/优先队列
// #include <queue>//队列
// #include <map>//映射
// #include <unordered_map>//哈希表
// #include <vector>//容器,存数组的数,表数组的长度
#include <bits/stdc++.h>


using namespace std;

typedef long long ll;

void solve()
{
    ll n;
    cin>>n;
    cout<<n/2<<endl;
}

int main()
{
    ll t;
    cin>>t;

    while(t--) solve();
    
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Pretty Boy Fox

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值