# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
125450 | 2019-07-05T10:33:04 Z | Touubs | CATS (NOI14_cats) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; #define dout if(false) cout #define int unsigned long long void testcase() { int X, L, N; cin >> X >> L >> N; int originalX = X; X--; int level = L/(2*N) + 1; dout << "level: " << level << endl; dout << "counter per iter" << counterPerIter; int flips = 0; dout << "counterPerIter: " << counterPerIter << endl; while (X > 0 && level > 0) { //cout << "X: " << X << ", flips: " << flips << " | "; if ((X & 1) == 1) flips = flips ^ 1; X = X >> 1; level--; } dout << endl << "end. flips: " << flips << endl; int min = (L/(2*N) + 1) * (2*N); cout << ((min ^ ((flips) & 1))) << endl; } signed main() { int Q; cin >> Q; for (int i = 0; i < Q; i++) { testcase(); } }