Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. # 710A : KING MOVES
  2. # Prerequisite : Implementation
  3.  
  4. # Algorithm:
  5. # Check for the corner cases
  6. # Check for the extreme row cases excluding corner
  7. # Check for the usual rows and columns
  8. move=raw_input()
  9. if (move[0]=='a' and (move[1]=='1' or move[1]=='8')) or (move[0]=='h' and (move[1]=='1' or move[1]=='8')):print 3
  10. elif (move[0]=='a' and move[1]!='1' and move[1]!='8') or \
  11. (move[0]=='h' and move[1]!='1' and move[1]!='8') or \
  12. (move[1] == '1' and move[0] != 'a' and move[0] != 'h') or \
  13. (move[1] == '8' and move[0] != 'a' and move[0] != 'h'): print 5
  14. else: print 8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement