Submit  All submissions  Best solutions  Back to list 
CLOCKPRO  Clock problems 
Wersja polska  English version 
John learns to read the time from a clock. The hardest cases are when both hands overlap. He would like to know how many times this troublesome situation will take place if he watches the clock from time A to time B.
Input
There is an unknown number of tests. Each test consists of one line which contains the time when John starts observing the clock and the time when he finishes (both in format hh:mm; 00:00 ≤ A,B ≤ 23:59). The observation lasts less than 24 hours.
Output
For each test the number of moments in which both hands will overlap, from time A to B.
Example
Input:
00:00 23:59
22:00 02:00
13:05 13:06 Output: 22
3
1
Added by:  Piotr Kąkol 
Date:  20140913 
Time limit:  1s30s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: SCM qobi 
Resource:  Problem AL_17_01 by Witold Długosz 
hide comments
20140926 01:55:01 Mitch Schwartz
@legrand: 1. 

20140920 16:40:41 legrand
what is the answer for 12:00 12:00 : 0 or 1 ? 

20140917 02:02:29 Piotr KÄ…kol
Fixed. Thanks. :) 

20140915 07:16:06 Mitch Schwartz
Time limit is too strict for slower languages, and there seems to be a formatting issue (maybe unexpected blank lines) for an early small input file. (FYI, my initial Ruby submission needed 23.69s to pass an input file containing all possible cases on Cube cluster.) Last edit: 20140915 07:32:03 