程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> it-Context-Free Clock

it-Context-Free Clock

編輯:編程解疑
Context-Free Clock

Description

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

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

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).
Sample Input

270 14:45:00
0 12:00:00
0 12:00:01
300 13:30:00
180 08:30:00
-1 00:00:00
Sample Output

15:00:00
12:00:00
13:05:27
14:00:00
09:16:21

最佳回答:


http://blog.csdn.net/u012925008/article/details/44280697?locationNum=3&fps=1

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved