Submission #7685

#TimeUsernameProblemLanguageResultExecution timeMemory
7685gs13068CATS (NOI14_cats)C++98
25 / 25
92 ms1088 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...