Advertisement
Bad_Programist

Untitled

Jan 28th, 2019
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. def play():
  2.     global A
  3.     global B
  4.     if (A[0] > B[0] and not (A[0] == 9 and B[0] == 0)) or (A[0] == 0 and B[0] == 9):
  5.         A.append(A[0])
  6.         A.append(B[0])
  7.         B.pop(0)
  8.         A.pop(0)
  9.     else:
  10.         B.append(A[0])
  11.         B.append(B[0])
  12.         A.pop(0)
  13.         B.pop(0)
  14.  
  15. A = list(map(int, input().split()))
  16. B = list(map(int, input().split()))
  17. k = 0
  18. while len(A) != 0 and len(B) != 0:
  19.     play()
  20.     k += 1
  21.     if k >= 10 ** 4:
  22.         break
  23. if len(A) == 0:
  24.     print('second', k)
  25. elif len(B) == 0:
  26.     print('first', k)
  27. else:
  28.     print('botva')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement