CSCI-101: Intro to Computer Science
Python Course

Spavanac

Every school morning Mirko is woken up by the sound of his alarm clock. Since he is a bit forgetful, quite often he leaves the alarm on on Saturday morning too. That’s not too bad tough, since he feels good when he realizes he doesn’t have to get up from his warm and cozy bed.

He likes that so much, that he would like to experience that on other days of the week too! His friend Slavko offered this simple solution: set his alarm clock 45 minutes early, and he can enjoy the comfort of his bed, fully awake, for 45 minutes each day.

Mirko decided to heed his advice, however his alarm clock uses 24-hour notation and he has issues with adjusting the time. Help Mirko and write a program that will take one time stamp, in 24-hour notation, and print out a new time stamp, 45 minutes earlier, also in 24-hour notation.

If you are unfamiliar with 24-hour time notation yourself, you might be interested to know it starts with 0:00 (midnight) and ends with 23:59 (one minute before midnight).

Your Program

Write a program which asks the user for two integers:

  1. The hour of the day that Mirko needs to get out of bed.
  2. The minute of the day that Mirko needs to get out of bed.

You may assume that the user will only enter positive integers for each input. Further, you may assume that the hours will be no greater than 23, and the minutes will be no greater than 59.

Then, you program should determine when Mirko needs to set his alarm and output the time (hours, then minutes, seperated by a space) on a single line.

Lab I/O Format

Your program should use the Lab Input/Output Format, as described below:

  • When prompting for input, use the prompt string WORD>, where WORD is a single, uppercase word which describes the input. For example, this lab you might choose two: HOURS> and MINUTES>.
  • When providing output that will be graded, start the line with OUTPUT. Think of this as "boxing your answer" on a math worksheet, it lets us quickly find your answer. We will ignore any lines which do not start with OUTPUT.
  • You may interleave the inputs and outputs in any order you wish. For example, you might want to recieve all of your inputs (order of inputs still matters!), then print all of your outputs (order of outputs still matters!), or you might want to do input/output, input/output, etc. For this lab, this will be unimportant, but know that you will have this freedom later on.

Example Interaction 1

HOURS> 10
MINUTES> 10
OUTPUT 9 25

Example Interaction 2

HOURS> 0
MINUTES> 30
OUTPUT 23 45

Example Interaction 3

HOURS> 23
MINUTES> 40
OUTPUT 22 55

License

This problem was derived from a problem from the Croatian Open Competition in Informatics 2009/2010, contest #7. License is for educational use only.