给定输入时间为以下任何一种格式的字符串,挑战是简单化的:
hh,hh:mm或hh:mm:ss有0 ≤ hh ≤ 23,0 ≤ mm ≤ 59和0 ≤ ss ≤ 59。
使用以下符号输出当前几点钟:
AA  LABEL FOR CHARACTER     CODE POINT   HEXADECIMAL
==  ====================    ==========   ===========
🕐  Clock Face 01 Oclock    128336       0x1F550  
🕑  Clock Face 02 Oclock    128337       0x1F551  
🕒  Clock Face 03 Oclock    128338       0x1F552  
🕓  Clock Face 04 Oclock    128339       0x1F553  
🕔  Clock Face 05 Oclock    128340       0x1F554  
🕕  Clock Face 06 Oclock    128341       0x1F555  
🕖  Clock Face 07 Oclock    128342       0x1F556  
🕗  Clock Face 08 Oclock    128343       0x1F557  
🕘  Clock Face 09 Oclock    128344       0x1F558  
🕙  Clock Face 10 Oclock    128345       0x1F559  
🕚  Clock Face 11 Oclock    128346       0x1F55A  
🕛  Clock Face 12 Oclock    128347       0x1F55B  
采用以下格式:
It is currently {Clock Face 1} with {mm} minutes and {ss} seconds until {Clock Face 2}.
示例(包括所有附带情况):
只有几个小时的情况...
f("12") = "It is currently 🕛."
带有小时和分钟的表壳...
f("12:30") = "It is currently 🕛 with 30 minutes until 🕐."
案件只有几个小时,但分钟数已包含为00 ...
f("12:00") = "It is currently 🕛."
带有小时,分钟和秒的表壳...
f("12:30:30") = "It is currently 🕛 with 29 minutes and 30 seconds until 🕐."
带有小时和分钟的表壳,但秒数包含为00 ...
f("12:30:00") = "It is currently 🕛 with 30 minutes until 🕐."
具有小时和分钟的情况,直到下一个小时不到一分钟...
f("12:59:59") = "It is currently 🕛 with 1 seconds until 🕐."
您不必从复数更改为单数。
带小时和分钟的表壳,下一个小时为1分钟...
f("12:59") = "It is currently 🕛 with 1 minutes until 🕐."
您不必从复数更改为单数。
使用军事时间的案例(是的,您必须处理)...
f("23:30:30") = "It is currently 🕚 with 29 minutes and 30 seconds until 🕛."
无效的案件...
f("PPCG") = This cannot occur, you are guaranteed a valid format by the definition of the problem.
f(66:66:66) = This cannot occur, you are guaranteed valid numbers by the definition of the problem.
f(24:60:60) = This cannot occur, you are guaranteed valid numbers by the definition of the problem.
对于无效的案例,您不必遵循任何输出样式,可以使用错误。
总体而言,挑战是相当简单的,但在我看来,它似乎足够动态以至于很有趣。这里最短的代码是赢家,因为除了长度以外,代码没有太多可变的方面。
0 < hh < 24,0 < mm < 60而且0 < ss < 60,你的意思是0 ≤ hh ≤ 23,0 ≤ mm ≤ 59和0 ≤ ss ≤ 59。
                AM还是PM标记?