Ravan's dream is to win tic-tac-toe championship.to accomplish this he practices alone at home to learn the strategies of the game . your task is to identify the cell where Ravan should place his third piece so that he wins the game. Assume that each cell in the tic-tac-toe board is marked with a number as shown in the below
TIC TAC TOE
0 1 2
3 4 5
6 7 8
input:
The first line of input contain two space-seperated integers representing the cells where Ravan has placed his first two pieces
output:
output should be a single line integer representing the cell where ravan should place his final piece
explanation
sample Output 1 :
ravan's first two moves are 0 and 1 so he not 2 to win the game .because it will complete the first row so the out put is 2
sample Output 2 :
ravan's first two moves are 0 and 3 so he not 6 to win the game .because it will complete the first row so the out put is 6
first, second = map(int, input().split(' '))
third = second + (second - first)
print(third)
Comments
Leave a comment