Canadian Computing Competition: 2017 Stage 1, Junior #3
You live in Grid City, which is composed of integer-numbered streets which run east-west (parallel to the
You drive a special electric car which uses up one unit of electrical charge moving between adjacent intersections: that is, moving either north or south to the next street, or moving east or west to the next avenue). Until your battery runs out, at each intersection, your car can turn left, turn right, go straight through, or make a U-turn. You may visit the same intersection multiple times on the same trip.
Suppose you know your starting intersection, your destination intersection and the number of units of electrical charge in your battery. Determine whether you can travel from the starting intersection to the destination intersection using the charge available to you in such a way that your battery is empty when you reach your destination.
Input Specification
The input consists of three lines. The first line contains
The second line contains
The third line contains an integer
For 3 of the 15 available marks,
For an additional 3 of the 15 marks available,
Output Specification
Output Y
if it is possible to move from the starting coordinate to the destination coordinate using exactly N
.
Sample Input 1
3 4
3 3
3
Sample Output 1
Y
Explanation for Sample Output 1
One possibility is to travel from
Sample Input 2
10 2
10 4
5
Sample Output 2
N
Explanation for Sample Output 2
It is possible to get from
It is also possible to travel using
It is also possible to travel using
It is not possible to move via any path of length
Comments
This question sure wants to stop climate change!
It's Edmonton! https://static.dmoj.ca/media/martor/f475c086-0aeb-4d59-92e9-20adaf3bb742.png
This comment is hidden due to too much negative feedback. Show it anyway.
why do i have a fan account???
famous :O
Yes, finally, future is here.
This comment is hidden due to too much negative feedback. Show it anyway.
You must be fun at parties