제출 #51282

#제출 시각아이디문제언어결과실행 시간메모리
51282BrunoPloumhansCATS (NOI14_cats)C++14
4 / 25
397 ms6900 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int popcount(int x) { int ans = 0; while(x != 0) { ans += (x&1); x >>= 1; } return ans; } signed main() { int q; cin >> q; while(q--) { int x, l, n; cin >> x >> l >> n; --x; int period = (l+2*n-1)/(2*n)*4; x %= period; // cout << x << " " << period << endl; cout << (l+2*n-1)/(2*n)*2*n+(popcount(x)%2) << '\n'; } return 0; }
#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...