#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll q,k,t,a,m;
long double x;
int main()
{
cin>>q;
while(q--)
{
cin>>k;
x=t=a=m=0;
x=(1.0+sqrt(1.0+8*k))/4;
t=floor(x);
a=(2+4*(t-1))*t/2;
if(k>a) k-=a;
else k=(t-1)*4+1,t--;
if(k<=t+1) cout<<k-1<<endl;
else if(k<=t*2+1) cout<<t*2+1-k<<endl;
else if(k<=t*3+1) cout<<-(k-t*2-1)<<endl;
else cout<<-(t*4+1-k)<<endl;
}
return 0;
}
对拍发现这些数出错
39999999724336123
39999999724336122
39999999724336121
39999999724336120
39999999724336119
39999999724336118
39999999724336117
39999999724336115
39999999724336114
39999999724336113
39999999724336112
39999999724336111
39999999724336110
39999999724336109
39999999724336108
剩余还有一些错,不知道为什么qwq