0

# King Move

The program receives the input of four numbers from 1 to 8, each specifying the column and row number, first two - for the first cell, and then the last two - for the second cell. The program should output YES if a king can go from the first cell to the second in one move, or NO otherwise. can anyone plz explain to me what equation to use but don't give me an answer please!

2 Answers

+ 1

you need to determine if both cells are direct neighboors of each others (|dx|==1 or |dy|==1)

0

Thanks! :D