#include <stdio.h>
typedef long long ll;
ll X,L,N;
int main() {
for(scanf("%*d");3==scanf("%lld%lld%lld",&X,&L,&N); ){
ll res = 0;
ll t = (L/(2*N)+2); if(t > 62) t = 62;
ll T = ((X-1) & ((1ll<<t)-1));
for(int i = 0; i < 60; i++) if((T >> i) & 1) ++res;
res &= 1;
res += 2*N + L/(2*N)*(2*N);
printf("%lld\n", res);
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1088 KB |
Output is correct |
2 |
Correct |
0 ms |
1088 KB |
Output is correct |
3 |
Correct |
0 ms |
1088 KB |
Output is correct |
4 |
Correct |
0 ms |
1088 KB |
Output is correct |
5 |
Correct |
0 ms |
1088 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1088 KB |
Output is correct |
2 |
Correct |
0 ms |
1088 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1088 KB |
Output is correct |
2 |
Correct |
0 ms |
1088 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1088 KB |
Output is correct |
2 |
Correct |
0 ms |
1088 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1088 KB |
Output is correct |
2 |
Correct |
4 ms |
1088 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
92 ms |
1088 KB |
Output is correct |
2 |
Correct |
104 ms |
1088 KB |
Output is correct |