forked from DVB7781/hacktoberfest2021
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlice vs Bob Faceoff.cpp
More file actions
83 lines (81 loc) · 1.93 KB
/
Alice vs Bob Faceoff.cpp
File metadata and controls
83 lines (81 loc) · 1.93 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// problem link - https://www.codechef.com/LTIME100B/problems/ALBOFACE
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
const long double Pi = 3.141592653;
const ll mod=1e9+7;
long long INF =1000000000000000000;
struct mycmp
{
bool operator()(pair<int,int>a,pair<int,int>b)const
{
return (a.first<b.first) || (a.first==b.first && a.second>b.second);
}
};
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t=1;cin>>t;
while(t--)
{
ll n;cin>>n;
if(n==1)
{
cout<<"Alice\n";
}
else
{
if(n&1LL)
{
n=n-1;
ll cnt=0;
while(n)
{
ll cnt1=0;
while(n%2==0)
n=n/2,++cnt1;
n=n-1;
if(cnt1>=2)
++cnt;
}
if(cnt>=2)
cout<<"Bob\n";
else
{
if(cnt==0)
cout<<"Alice\n";
else
cout<<"Bob\n";
}
}
else
{
ll cnt=0;
while(n)
{
ll cnt1=0;
while(n%2==0)
n=n/2,++cnt1;
n=n-1;
if(cnt1>=2)
++cnt;
}
//cout<<cnt<<"\n";
if(cnt>=2)
cout<<"Alice\n";
else
{
if(cnt==0)
cout<<"Bob\n";
else
cout<<"Alice\n";
}
}
}
}
}