-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAlice_Bob.py
46 lines (44 loc) · 820 Bytes
/
Alice_Bob.py
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
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 5 12:34:03 2020
@author: Ravi
"""
n = input()
n=int(n)
c = 0
alice = 0
bob = 0
who = True
for i in range(n):
#for alice true and for bob false
if who:
if n>=4:
alice +=4
n=n-4
who = False
else:
if n>=1:
alice +=1
n=n-1
who = False
else:
if n>=4:
bob +=4
n=n-4
who = True
else:
if n>=1:
bob +=1
n=n-1
who = False
if alice == bob:
if who == False:
print("Bob")
else:
print("Alice")
else:
if alice > bob:
print("Alice")
else:
print("Bob")
#print('Alice = '+str(alice)+' Bob = '+str(bob))