Brightness Begins

Problem

Imagine you have n n n light bulbs numbered 1 , 2 , … , n 1, 2, \ldots, n 1,2,,n. Initially, all bulbs are on. To flip the state of a bulb means to turn it off if it used to be on, and to turn it on otherwise.
Next, you do the following:- for each i = 1 , 2 , … , n i = 1, 2, \ldots, n i=1,2,,n, flip the state of all bulbs j j j such that j j j is divisible by i † i^\dagger i.After performing all operations, there will be several bulbs that are still on. Your goal is to make this number exactly k k k.Find the smallest suitable n n n such that after performing the operations there will be exactly k k k bulbs on. We can show that an answer always exists. † ^\dagger An integer x x x is divisible by y y y if there exists an integer z z z such that x = y ⋅ z x = y\cdot z x=yz.

Input

Each test contains multiple test cases. The first line contains the number of test cases t t t ( 1 ≤ t ≤ 1 0 4 1 \le t \le 10^4 1t104). The description of the test cases follows.The only line of each test case contains a single integer k k k ( 1 ≤ k ≤ 1 0 18 1 \le k \le 10^{18} 1k1018).

Output

For each test case, output n n n — the minimum number of bulbs.

Example

input
3
1
3
8
output
2
5
1
1

Note

In the first test case, the minimum number of bulbs is 2 2 2. Let’s denote the state of all bulbs with an array, where 1 1 1 corresponds to a turned on bulb, and 0 0 0 corresponds to a turned off bulb. Initially, the array is [ 1 , 1 ] [1, 1] [1,1].- After performing the operation with i = 1 i = 1 i=1, the array becomes [ 0 ‾ , 0 ‾ ] [\underline{0}, \underline{0}] [0,0].- After performing the operation with i = 2 i = 2 i=2, the array becomes [ 0 , 1 ‾ ] [0, \underline{1}] [0,1].In the end, there are k = 1 k = 1 k=1 bulbs on. We can also show that the answer cannot be less than 2 2 2.In the second test case, the minimum number of bulbs is 5 5 5. Initially, the array is [ 1 , 1 , 1 , 1 , 1 ] [1, 1, 1, 1, 1] [1,1,1,1,1].- After performing the operation with i = 1 i = 1 i=1, the array becomes [ 0 ‾ , 0 ‾ , 0 ‾ , 0 ‾ , 0 ‾ ] [\underline{0}, \underline{0}, \underline{0}, \underline{0}, \underline{0}] [0,0,0,0,0].- After performing the operation with i = 2 i = 2 i=2, the array becomes [ 0 , 1 ‾ , 0 , 1 ‾ , 0 ] [0, \underline{1}, 0, \underline{1}, 0] [0,1,0,1,0].- After performing the operation with i = 3 i = 3 i=3, the array becomes [ 0 , 1 , 1 ‾ , 1 , 0 ] [0, 1, \underline{1}, 1, 0] [0,1,1,1,0].- After performing the operation with i = 4 i = 4 i=4, the array becomes [ 0 , 1 , 1 , 0 ‾ , 0 ] [0, 1, 1, \underline{0}, 0] [0,1,1,0,0].- After performing the operation with i = 5 i = 5 i=5, the array becomes [ 0 , 1 , 1 , 0 , 1 ‾ ] [0, 1, 1, 0, \underline{1}] [0,1,1,0,1].In the end, there are k = 3 k = 3 k=3 bulbs on. We can also show that the answer cannot be smaller than 5 5 5.

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;

int main()
{
    ll t;
    cin>>t;
    
    while(t--)
    {
        ll k;
        cin>>k;
        cout<<k+ll(sqrt(k)+0.5)<<endl;
    }
    
    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、付费专栏及课程。

余额充值