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
-
If the current temperature is below
and the temperature is not rising then raise the control rods to increase temperature. -
If the current temperature is below
but the temperature is rising then keep the control rods where they are. -
If the current temperature is exactly
then keep the control rods where they are. -
If the current temperature is above
and the temperature is not falling then lower the control rods to reduce temperature. -
If the current temperature is above
but the temperature is falling then keep the control rods where they are. -
If the current temperature is
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
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 |