Skip to content
This repository was archived by the owner on Oct 24, 2020. It is now read-only.

Commit 9e69314

Browse files
authored
Create ChefWar.py
1 parent 9dc99d9 commit 9e69314

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Codechef solutions/ChefWar.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
def game(h,p):
2+
h=h-p
3+
if(h<0):
4+
h=0
5+
p=p//2
6+
return h,p
7+
try:
8+
t=int(input())
9+
for i in range(t):
10+
h,p=map(int,input().split())
11+
# if(h==1 and p==1):
12+
# print(1)
13+
if(1==1):
14+
while(h!=0 and p!=0):
15+
(h,p)=game(h,p)
16+
if(p==0 and h!=0):
17+
print(0)
18+
elif(h==0 and p!=0):
19+
print(1)
20+
elif(p==0 and h==0):
21+
print(1)
22+
except:
23+
pass

0 commit comments

Comments
 (0)