编程介的小学生 2017-07-31 09:50 采纳率: 20.5%
浏览 786
已采纳

Digital Clock

Digital clocks usually show the time in the form hh:mm:ss, where hh is a number between 00 and 23, and both mm and ss are numbers between 00 and 59. Removing the colons from hh:mm:ss will result in an integer hhmmss, which is called a clock integer. For example, the clock integer of 17:05:13 is 170513 and the clock integer of 00:07:37 is 737.

You are given a time interval and you are to determine the number of clock integers in it that are multiples of 3. A time interval will be given by specifying its start and end time. For example, the time interval [00:59:58, 01:01:24] has a total of 1+1+60+25=87 clock integers, namely, 5958, 5959, 10000 through 10059, and 10100 through 10124. How many of them are multiples of 3?

Note that a time interval that includes midnight may have a start time greater than its end time, as in [22:47:03, 01:03:24]. You may assume that a time interval is at least one second long and shorter than 24 hours.

Write a program that can determine the number of multiples of 3 in a time interval.

Input

Your program is to read from standard input. The input consists of T test cases. The number of test cases T is given in the first line of the input. Each test case consists of a single line that contains the start time and end time of a time interval, which are separated by a single space.

Output

Your program is to write to standard output. Each test case outputs exactly one line. Print the number of multiples of 3 among the clock integers in the time interval. The following shows a sample input with three test cases and its output.

Sample Input

3
00:59:58 01:01:24
22:47:03 01:03:24
00:00:09 00:03:37
Sample Output

29
2727
70

  • 写回答

2条回答 默认 最新

查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序