-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3459.cpp
More file actions
56 lines (54 loc) · 806 Bytes
/
3459.cpp
File metadata and controls
56 lines (54 loc) · 806 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// 3459. 승자 예측하기
// 2019.07.10
#include<iostream>
#include<string>
using namespace std;
long long mul[31];
int main()
{
int test_case;
int T;
ios::sync_with_stdio(false);
cin.tie(0);
cin >> T;
mul[0] = 1;
for (int i = 1; i <= 30; i++)
{
mul[i] = mul[i - 1] * 4;
}
for (test_case = 1; test_case <= T; ++test_case)
{
long long n;
cin >> n;
n -= 1;
// n-1==0 즉 n이 1일땐 Bob의 승리
if (n == 0)
{
cout << "#" << test_case << " Bob\n";
continue;
}
else
{
string ans = "";
int cnt = 1;
while (1)
{
n -= mul[cnt];
if (n <= 0)
{
ans = "Alice";
break;
}
n -= mul[cnt];
if (n <= 0)
{
ans = "Bob";
break;
}
cnt++;
}
cout << "#" << test_case << " " << ans << "\n";
}
}
return 0;
}