[Solution] Journey of the Knight CodeChef Solution 2022
Chef has an chessboard. He placed a knight on the square . Note that, the square at the intersection of the row and column is denoted by .
Chef wants to determine whether the knight can end up at the square in exactly moves or not.
For reference, a knight can move to a square which is:
- One square horizontally and two squares vertically away from the current square, or
- One square vertically and two squares horizontally away from the current square
A visual description of this may be found here.
Input Format
- The first line contains a single integer — the number of test cases. Then the test cases follow.
- The first and only line of each test case contains integers — where denotes the starting square of the knight and denotes the ending square of the knight.
Output Format
For each test case, output YES
if knight can move from to in exactly moves. Otherwise, output NO
.
Pass the Exam CodeChef Solution
Chef and Candies CodeChef Solution
Journey of the Knight CodeChef Solution
Slow Solution CodeChef Solution
Game of Piles Version 1 CodeChef Solution
Find A, B, C CodeChef Solution
Largest Square in the garden CodeChef Solution
Game of Piles Version 2 CodeChef Solution
You may print each character of YES
and NO
in uppercase or lowercase (for example, yes
, yEs
, Yes
will be considered identical).
No comments:
Post a Comment