1 /**\
2 https://codeforces.com/contest/1426/problem/C
3 先自增再进行复制,这样最优,把一个数从1变成x,需要x-1次。
4 然后暴力枚举一遍,找到最小值就行了
5 \**/
6 #include <bits/stdc++.h>
7 using namespace std;
8 #define fi first
9 #define se second
10 #define go continue
11 #define int long long
12 #define PII pair<int, int>
13 #define sf(x) scanf("%lld",&x)
14 #define ytz int _; sf(_); while(_--)
15 #define fory(i,a,b) for(int i = a; i <= b; ++i)
16 #define forl(i,a,b) for(int i = a; i >= b; --i)
17 #define debug(a) cout << #a << " = " << a <<endl;
18 signed main()
19 {
20 ytz
21 {
22 int n;
23 sf(n);
24 int ans = 1e18;
25 fory(i, 1, n)
26 {
27 int cnt = i - 1;
28 cnt += (n - i) / i;
29 if(n % i) cnt++; //没有取干净
30 if(cnt <= ans) ans = cnt;
31 else break; //不然就开始自增了,直接break
32 }
33 printf("%lld\n", ans);
34 }
35 return 0;
36 }