-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaliceVsBobFaceoff.cpp
More file actions
41 lines (40 loc) · 824 Bytes
/
Copy pathaliceVsBobFaceoff.cpp
File metadata and controls
41 lines (40 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
long long int n;
cin >> n;
long long int c = (n & 1LL) ? 0 : 1;
while (n != 0)
{
if (n == 1LL)
{
c++;
n--;
}
else if ((n & 1LL) == 1 && (n & 2) == 0)
{
n = n >> 1;
while (n & 1LL == 0)
n = n >> 1;
c += 2;
}
else if ((n & 1LL) == 1)
{
c += 2;
n = n >> 1;
}
else
n = n >> 1;
}
if ((c & 1LL) == 0)
cout << "Bob";
else
cout << "Alice";
cout << "\n";
}
}