Arno's Sleep Schedule
Time limit1sMemory limit1024 MB
Given the hour Arno goes to sleep and the hour his alarm rings, print how many hours he sleeps, wrapping past midnight when needed.
- Level
Easy1 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
Arno wants to arrive at school before classes start, so he sets an alarm clock for the morning. He wonders how many hours he will sleep. Write a program that calculates the length of Arno's sleep.
Input
There are two lines in the input, each containing one number. The first line contains an integer from to or from to : the time Arno goes to sleep. The second line contains an integer from to : the time at which Arno's alarm rings and wakes him up. All times are integers in 24-hour format.
Output
Output a single integer: the number of hours from the time Arno goes to sleep to the time he wakes up. You may assume that Arno sleeps continuously from the time he goes to sleep until the alarm rings, and that he does not sleep for more than hours in a row. NB! The output must not contain any other words or symbols, so it should contain exactly one integer.