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 tcn;
scanf("%d",&tcn);
while(tcn--)
{
long long K,P;
long long T,X,L,N;
scanf("%lld%lld%lld",&X,&L,&N);
X--;
N<<=1;
T=(L+N-1)/N;
K=T-1;
if(K>62)K=62;
P=X%4;
X=(X/4)&((1LL<<K)-1);
for(K=0;X;X>>=1)K^=X&1;
if((P==0||P==3)==K)printf("%lld\n",T*N+1);
else printf("%lld\n",T*N);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |