본문 바로가기

PKU & UVa problems/Original problem

PKU 2840. Big Clock

Big Clock
Time Limit: 1000MS Memory Limit: 131072K
Total Submissions: 4397 Accepted: 2802

Description

Our vicar raised money to have the church clock repaired for several weeks. The big clock, which used to strike the hours days and nights, was damaged several weeks ago and had been silent since then. 

After the clock was repaired, it works all right, but there is still something wrong with it: the clock will strike thirteen times at one o’clock, fourteen times at two o’clock... 24 times at 12:00, 1 time at 13:00... 

How many times will it strike now? 

Input

The first line consists of only one integer T (T <= 30), representing the number of test cases. Then T cases follow. 

Each test case consists of only one line, representing the time now. Each line includes 2 integers H, M separated by a symbol ":". (0 <= H < 24, 0 <= M < 60) 

Output

For each test case, output the answer in one line.

Sample Input

3
1:00
01:01
00:00

Sample Output

13
0
12

Source

'PKU & UVa problems > Original problem' 카테고리의 다른 글

PKU 2234. Matches Game  (0) 2009.06.02
PKU 2243. Knight Moves  (0) 2009.05.12
PKU 2656. Unhappy Jinjin  (0) 2009.05.05
PKU 1163. The Triangle  (0) 2009.04.04
PKU 2039. To and Fro  (0) 2009.03.25