Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long I64;
- I64 last(I64 n, bool inc)
- {
- if (n == 1)
- return 0;
- I64 recurs = last((n - inc) / 2, inc ^ (n & 1LL));
- return 2 * recurs + !inc;
- }
- void solve()
- {
- I64 n, k;
- cin >> n >> k;
- I64 ans = last(n, 0);
- ans = (ans + k - 1) % n + 1;
- cout << ans << ((n & 1LL) ? " Light\n" : " L\n");
- }
- int main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- int t = 1;
- cin >> t; /// comment
- while (t--) {
- solve();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement