#include <bits/stdc++.h>
#define N 1000001
using namespace std;
typedef long long ll;
const ll INF = 1e18, MOD = 1e9 + 7, MOD2 = 1e6 + 3;
int q;
int main () {
cin >> q;
for (int i = 0; i < q; i++) {
ll x, l, n;
cin >> x >> l >> n;
if (l / (2 * n) + 1 <= 60) x %= (1LL << (l / (2 * n) + 2));
cout << 2 * n * (l / (2 * n) + 1) + __builtin_popcount (x - 1) % 2 << '\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
248 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
6 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
5 ms |
256 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
376 KB |
Output is correct |
2 |
Incorrect |
9 ms |
376 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
376 KB |
Output is correct |
2 |
Incorrect |
48 ms |
376 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
493 ms |
2296 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |