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

建议使用的浏览器:

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

2815:Context-Free Clock

题目描述
You recently installed a stylish clock in your office that is perfectly round and has no markings that identify its orientation. After accidentally bumping it, you realized that 12 o'clock might no longer be at the top. Nonetheless, you want to figure out what time it is. Fortunately you recently overheard A a coworker giving the time and you have a protractor and can measure the angle between the hour and minute hands.

Your program should print the first time that has the correct angle between the hour and minute hands and that is on or after the overheard time. The angle (0 to 359 degrees, inclusive) will be measured clockwise from the hour hand to the minute hand. Assume that the clock hands move smoothly.
输入解释
Input will consist of one test case per line, of the form


A HH :MM :SS


where A is the integral number of degrees that must be traversed clockwise to get from the hour hand to the minute hand and HH : MM : SS is the overheard time in 24 hour form. 0 <= A <= 359 , 0 <= HH <= 23 , 0 <= MM <= 59 , and 0 <= SS <= 59 . HH , MM , and SS will be exactly two digits with a leading zero if necessary.

End of input will be signaled by the line

-1 00:00:00
输出解释
Output will consist of one line per test case, of the form


HH :MM :SS


where HH : MM : SS is the first time on or after the input time where the angle from the hour hand to the minute hand is exactly A degrees, rounded down to the nearest second. HH, MM , and SS should be zero padded to two digits and in the same range as the input ( 0...23 , 0...59 , and 0...59 respectively).
输入样例
270 14:45:00 
0 12:00:00 
0 12:00:01 
300 13:30:00 
180 08:30:00 
-1 00:00:00
输出样例
15:00:00 
12:00:00 
13:05:27 
14:00:00 
09:16:21

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Mid-Atlantic 2005

源链接: POJ-2815

最后修改于 2020-10-29T06:45:01+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536