# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
7686 | gs13068 | CATS (NOI14_cats) | C++98 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<cstdio>
int main()
{
int TC;
scanf("%d",&TC);
while(TC--)
{
long long K,X,L,N,C;
scanf("%lld%lld%lld",&X,&L,&N);
X=X-1;
K=(L+2*N-1)/(2*N);
for(T=K/(2*N)+1;X>0&&T>0;X>>=1)C^=X&1;
printf("%lld\n",K+C);
}
}