正文
增加 3 行删除 3 行
2 行未改动3456789101151 行未改动6364656667686970713 行未改动7576777879808182835 行未改动2 行未改动设 $k = \lfloor \sqrt{x} \rfloor$,那么:$k<=\sqrt{x}<k+1$即:$k ^2≤x<(k+1)^2$且$k \mid x$,所以 $x$ 是 $k$ 的倍数。51 行未改动# code:```cpp#include<bits/stdc++.h>#define orz freopen("sqrt.in","r",stdin);#define qp freopen("sqrt.out","w",stdout);using namespace std;signed main() {3 行未改动cin >> T;while(T--) {long long n;cin >> n;long long tot = sqrtl(n);long long ans = 3 * (tot - 1) + (n / tot - tot + 1);cout << ans << '\n';}return 0;5 行未改动2 行未改动3456789101151 行未改动6364656667686970713 行未改动7576777879808182835 行未改动2 行未改动设 $k = \lfloor \sqrt{x} \rfloor$,那么:$k<=\sqrt{x}<k+1$即:$k ^2≤x<(k+1)^2$且$k \mid x$,所以 $x$ 是 $k$ 的倍数。51 行未改动# code:```cpp#include<bits/stdc++.h>#define orz freopen("sqrt.in","r",stdin);#define qp freopen("sqrt.out","w",stdout);using namespace std;signed main() {3 行未改动cin >> T;while(T--) {long long n;cin >> n;long long tot = sqrtl(n);long long ans = 3 * (tot - 1) + (n / tot - tot + 1);cout << ans << '\n';}return 0;5 行未改动