You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
346 B
C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
int T;
ll n, k;
scanf("%d", &T);
while (T--)
{
scanf("%lld%lld", &n, &k);
if (k == 1)
printf("%lld\n", array<ll, 4>({n, 1, n + 1, 0})[n & 3]);
else
{
}
}
return 0;
}