Advertisement
Guest User

Untitled

a guest
Dec 28th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. from sys import stdin
  2. def main():
  3. lines = stdin.read().splitlines()
  4. idx = 0
  5. teams = {'A': 1, 'B': 2, 'C': 1, 'D': 2}
  6. lazy = (0, 2, 1)
  7. try:
  8. while True:
  9. w = b = 9
  10. r = 0
  11. start = teams[lines[idx][0]]
  12. while True:
  13. line = lines[idx]
  14. idx += 1
  15. if line is '#':
  16. break
  17. w -= int(line[2])
  18. b -= int(line[4])
  19. if int(line[-1]):
  20. r = teams[line[0]]
  21. points = 0
  22. if r:
  23. if w and b:
  24. print 'Incomplete game.'
  25. else:
  26. if w:
  27. winner = lazy[start]
  28. points += w
  29. else:
  30. winner = start
  31. points += b
  32. if winner is r:
  33. points += 5
  34. print 'Team-{0} win and the point is {1}.'.format(winner, points)
  35. else:
  36. print 'Incomplete game.'
  37. except IndexError:
  38. pass
  39. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement