문제1555--Bigital

1555: Bigital

실행시간 제한: 1 Sec  메모리사용 제한: 128 MB
제출: 86  통과: 59
[제출] [채점기록] [묻고답하기]

문제 설명

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 watt seconds (3600 watt seconds = 1 watt 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.

입력 설명

The first line of the input gives the number of test cases, T. T test cases follow, each test case consists one line, tStart and tEnd. tStart and tEnd will each contain exactly 8 characters. tStart and tEnd will each be in the form hh:mm:ss, where hh is between 01 and 12, inclusive, mm is between 00 and 59, inclusive, and ss is between 00 and 59, inclusive.

출력 설명

For each test case, output one line containing "Case #x: y", where x is the case number (starting from 1), and y is total number of watt seconds.

입력 예시 Copy

3
12:00:00 12:00:00
12:59:59 01:00:00
12:01:00 12:00:00

출력 예시 Copy

Case #1: 2
Case #2: 11
Case #3: 302122

출처/분류