Problem D
Test Drive
Larry developed a new driverless car, and he’s about to test it. He’ll be working from home and analyzing what the car does in a straight, empty road from a safe distance.
Due to an unprecedented issue, the only information that Larry’s able to get from the car is its position in meters from the start of the road. While he gets an update every minute, he would like to know what the car has been doing.
Given three distinct positions $a$, $b$, and $c$ taken one minute from each other, Larry would like to know if the car switched direction, or if it braked, accelerated, or cruised at the same speed. Can you help out Larry?
Input
Input consists of a single line with three distinct space-separated integers $0 \leq a, b, c \leq 1\, 000$, the position of the car in meters from the start of the road, measured every minute.
Output
If the car changed direction, output turned. Otherwise, output accelerated if it travelled a greater distance in the second minute than the first, braked if it travelled a smaller distance in the second minute than the first, or cruised if it travelled the same distance during both minutes.
Sample Input 1 | Sample Output 1 |
---|---|
1 2 3 |
cruised |
Sample Input 2 | Sample Output 2 |
---|---|
5 4 1 |
accelerated |
Sample Input 3 | Sample Output 3 |
---|---|
8 9 7 |
turned |
Sample Input 4 | Sample Output 4 |
---|---|
10 20 25 |
braked |