My friend has a "bigital" clock. It displays 12-hour times in the
form hh:mm:ss, using 6 columns of 1 watt light bulbs.
Each column displays its value in binary, where a light is off
to indicate a 0 and is on to indicate a 1. The clock can display all
12-hour times, from 01:00:00 to 12:59:59.
For example, 03:22:59 requires 8 lights to be on and looks like this:
0 0 0 0 0 1
0 0 0 0 1 0
0 1 1 1 0 0
0 1 0 0 1 1
Given tStart and tEnd, return the total number of kilowatt
hours used by the clock in displaying all the times from tStart to tEnd,
inclusive. The start and end time are less than 12 hours apart.
|