当前位置:网站首页>Big Ben (Lua)
Big Ben (Lua)
2022-07-07 19:04:00 【Just be interesting】
subject
There is a claim on weibo “ Big Ben V” The guy who , Bells are rung every day to urge the farmers to take good care of their health and go to bed early . But since Ben doesn't work and rest regularly on his own , So the ringing of the bell is irregular . Generally, the number of striking bells is determined by the striking time , If I happen to knock on the hour , that “ When ” It's going to be equal to that integral ; If it's past the hour , I'm just going to knock on the next one . in addition , Although one day 24 Hours , The clock struck only the second half of the day 1~12 Next . For example, in 23:00 bell , Namely “ Dang dang dang dang dang dang dang dang dang dang dang dang ”, And by the 23:01 It would be “ Dangdang dangdang dangdang dangdang ”. In the middle of the night 00:00 Until noon 12:00 period ( Endpoint time is included ), Stupid clocks don't strike .
Now write a program , Ring Big Ben according to the current time .
Input format :
Enter the first line as follows hh:mm Gives the current time . among hh Is the hour , stay 00 To 23 Between ;mm Is a minute , stay 00 To 59 Between .
Output format :
Ring Big Ben according to the current time , That is, the corresponding number of output in a line Dang. If it's not the bell-ringing period , The output :
Only hh:mm. Too early to Dang.
among hh:mm It's the input time .
sample input 1:
19:05
sample output 1:
DangDangDangDangDangDangDangDang
sample input 2:
07:05
sample output 2:
Only 07:05. Too early to Dang.
Code
local s = io.read()
local h, m = tonumber(s:sub(1, 2)), tonumber(s:sub(4, 5))
local str = ""
if h < 12 or (h == 12 and m == 0) then
str = string.format("Only %02d:%02d. Too early to Dang.", h, m);
else
if m > 0 then
str = string.rep("Dang", h - 11)
else
str = string.rep("Dang", h - 12)
end
end
print(str)
边栏推荐
- Redis publishing and subscription
- 线程池和单例模式以及文件操作
- Rules for filling in volunteers for college entrance examination
- Reinforcement learning - learning notes 8 | Q-learning
- Save the memory of the model! Meta & UC Berkeley proposed memvit. The modeling time support is 30 times longer than the existing model, and the calculation amount is only increased by 4.5%
- 云安全日报220707:思科Expressway系列和网真视频通信服务器发现远程攻击漏洞,需要尽快升级
- [论文分享] Where’s Crypto?
- Improve application security through nonce field of play integrity API
- POJ 2392 Space Elevator
- Do you really understand sticky bag and half bag? 3 minutes to understand it
猜你喜欢

Calculation of torque target value (ftorque) in servo torque control mode

Desci: is decentralized science the new trend of Web3.0?

10 schemes to ensure interface data security

Nat address translation

gsap动画库

Wireshark analyzes packet capture data * cap

直播预约通道开启!解锁音视频应用快速上线的秘诀

如何选择合适的自动化测试工具?

Mathematical analysis_ Notes_ Chapter 11: Fourier series

Kubernetes DevOps CD工具对比选型
随机推荐
面试唯品会实习测试岗、抖音实习测试岗【真实投稿】
Skills of embedded C language program debugging and macro use
低代码助力企业数字化转型会让程序员失业?
Industry case | digital operation base helps the transformation of life insurance industry
UVALive – 4621 Cav 贪心 + 分析「建议收藏」
Nat address translation
脑洞从何而来?加州大学最新研究:有创造力的人神经连接会「抄近道」
Cadre de validation des données Apache bval réutilisé
Interview vipshop internship testing post, Tiktok internship testing post [true submission]
Comparison and selection of kubernetes Devops CD Tools
高考填志愿规则
Complete e-commerce system
coming! Gaussdb (for Cassandra) new features appear
A hodgepodge of ICER knowledge points (attached with a large number of topics, which are constantly being updated)
我感觉被骗了,微信内测 “大小号” 功能,同一手机号可注册两个微信
[sword finger offer] 59 - I. maximum value of sliding window
99% of people don't know that privatized deployment is also a permanently free instant messaging software!
Short selling, overprinting and stock keeping, Oriental selection actually sold 2.66 million books in Tiktok in one month
【塔望方法论】塔望3W消费战略 - U&A研究法
2022上半年朋友圈都在传的10本书,找到了