Problem I
Comrade Computer Operator
Your nation’s prestigious reputation is being tarnished by the evil foreign media due to a slight mishap in one of its nucelar power plants. To prevent this from happening again, the wise leaders of your nation have given you the task to create a computer program that controls reactor temperature. At regular intervals, the temperature of the water in the reactor is measured. The last two measurements are given to the program, which then decides what should be done with the control rods in order to maintain an optimum operating temperature of $300^\circ C$. The control logic is as follows:
-
If the current temperature is below $300^\circ C$ and the temperature is not rising then raise the control rods to increase temperature.
-
If the current temperature is below $300^\circ C$ but the temperature is rising then keep the control rods where they are.
-
If the current temperature is exactly $300^\circ C$ then keep the control rods where they are.
-
If the current temperature is above $300^\circ C$ and the temperature is not falling then lower the control rods to reduce temperature.
-
If the current temperature is above $300^\circ C$ but the temperature is falling then keep the control rods where they are.
-
If the current temperature is $350^\circ C$ or higher then initiate emergency shutdown procedures.
Can you write the program and save your nation’s reputation?
Input
The input consists of two lines. The first line contains one integer $a$, the current temperature, where $0 \leq a \leq 400$. The second line contains one integer $b$, the previous temperature, where $0 \leq b \leq 349$.
Output
Depending on the pair of measurements, output raise, keep, lower or shutdown.
Sample Input 1 | Sample Output 1 |
---|---|
300 300 |
keep |
Sample Input 2 | Sample Output 2 |
---|---|
290 289 |
keep |
Sample Input 3 | Sample Output 3 |
---|---|
290 291 |
raise |
Sample Input 4 | Sample Output 4 |
---|---|
301 302 |
keep |
Sample Input 5 | Sample Output 5 |
---|---|
305 305 |
lower |
Sample Input 6 | Sample Output 6 |
---|---|
350 345 |
shutdown |