Untitled
unknown
plain_text
a year ago
1.6 kB
12
Indexable
#include <bits/stdc++.h>
using namespace std;
#define int unsigned long long
void __print(int x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
// void __print(unsigned int x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V> void __print(const pair<T, V> &x) {
cerr << '{';
__print(x.first);
cerr << ',';
__print(x.second);
cerr << '}';
}
template <typename T> void __print(const T &x) {
int f = 0;
cerr << '{';
for (auto &i : x)
cerr << (f++ ? "," : ""), __print(i);
cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V> void _print(T t, V... v) {
__print(t);
if (sizeof...(v))
cerr << ", ";
_print(v...);
}
#ifndef ONLINE_JUDGE
#define debug(x...) \
cerr << "[" << #x << "] = ["; \
_print(x)
#else
#define debug(x...)
#endif
void solve() {
int k;
cin >> k;
int l = 0,r=1e36;
int ans = 0;
while(l<=r){
int mid = l + (r-l)/2;
int x = mid;
int sum = 0;
int sqrtx = sqrt(x);
if(x - sqrtx >=k){
ans = mid;
r = mid-1;
}
else{
l = mid+1;
}
}
cout << ans << endl;
}
signed main() {
int t = 1;
cin >> t;
while (t--) {
solve();
}
return 0;
}Editor is loading...
Leave a Comment