当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1371:Clock

题目描述
You are given a standard 12-hour clock with analog display, an hour hand and a minute hand. How many times does the minute hand pass the hour hand in a given time interval?
输入解释
The input contains an indefinite number of lines; each line contains four numbers.

The first pair of numbers represents an "initial time" the second pair represents a "final time."

In each such number pair, the first number represents hours, second number represents minutes.

The hours will be in the range 1..12, the minutes in the range 0..59.

No initial time and no final time will be an instant at which the minute hand just passes the hour hand. (In particular, 12 00 will not occur as an initial or final time.)

No initial time will be the same as the corresponding final time.

Between each initial time and corresponding final time, the hour hand will have turned less than one full revolution (360 degrees).

As the hour hand turns from its initial position to its final position, it may or may not sweep past the number 12 on the clock's dial.

If it does, then either the initial time is an "A.M." time and the final time a "P.M." time, or vice versa.

If it does not, then either both times (initial and final) are "A.M." or both are "P.M."

Each line of input gives rise to one line of output, containing

the initial and final times, and

the number of times the minute hand passes the hour hand between the initial time and the final time.

Observe all details of formatting, such as upper/lower case letters, punctuation, blank spaces, and the absence of blank lines.

In each time display, the hours and minutes are displayed in fields of width 2, separated by a colon.

The ten's digit (of hours or minutes) is displayed as a zero if it is zero.
输出解释
Here is a formatting template shown between two lines of the above output:

Initial time Final time Passes
12345678901234567890123456789012
12:50 01:02 0

输入样例
12 50  1  2
 3  8  3 20
 2 45 11  0
11  0  3 20
 1  2 12 50
 3 20  3  8
输出样例
Program 3 by team X
Initial time  Final time  Passes
       12:50       01:02       0
       03:08       03:20       1
       02:45       11:00       8
       11:00       03:20       4
       01:02       12:50      11
       03:20       03:08      10
End of program 3 by team X
来自杭电HDUOJ的附加信息
Recommend Eddy

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 Rocky Mountain 2000

源链接: HDU-1371

最后修改于 2020-10-25T22:44:23+00:00 由爬虫自动更新

共提交 292

通过率 76.37%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/32768K(Java/Others)