007. Clock Seconds

007. Clock Seconds
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
You have a clock that tells time in the usual way: hours, minutes, and seconds. When you wake up in the morning, you want to figure out how many seconds you slept for. Conveniently, you fell asleep the night before at exactly 12:00 AM. Remember that there are 60 seconds in a minute and 60 minutes in an hour.
Input
The first line of input contains a positive integer h indicating the current number of hours displayed on the clock (1 <= h <= 11). The second line of input contains a positive integer m indicating the current number of minutes displayed on the clock (0 <= m <= 59) The third line of input contains a positive integer s indicating the current number of seconds displayed on the clock (0 <= s <= 59) The fourth line of input contains a string a indicating whether it is currently the morning or the afternoon.  a will be either AM or PM. You are guaranteed to have slept for less than 24 hours. Also, note that h will never equal 12.
Output
Print a single positive integer t: the number of seconds of sleep that you got.
Example
input
Copy
6
50
34
AM
output
Copy
24634

Comments

Popular posts from this blog

How to pass parameters in webhook?

Access and modify all the resources of our Wiki.js using WikiJS API

Fahrenheit to Celsius