当前位置:网站首页>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)
边栏推荐
- 数据验证框架 Apache BVal 再使用
- The moveposition function of rigidbody2d of unity2d solves the problem of people or screen jitter when moving
- C语言中匿名的最高境界
- Scientists have observed for the first time that the "electron vortex" helps to design more efficient electronic products
- Redis
- 前首富,沉迷种田
- Redis的发布与订阅
- 面试唯品会实习测试岗、抖音实习测试岗【真实投稿】
- 脑洞从何而来?加州大学最新研究:有创造力的人神经连接会「抄近道」
- Wechat web debugging 8.0.19 replace the X5 kernel with xweb, so the X5 debugging method can no longer be used. Now there is a solution
猜你喜欢

链式二叉树的基本操作(C语言实现)

3.关于cookie

How to choose the appropriate automated testing tools?

【Unity Shader】插入Pass实现模型遮挡X光透视效果

CVPR 2022 - learning non target knowledge for semantic segmentation of small samples

6.关于jwt

Mathematical analysis_ Notes_ Chapter 11: Fourier series

Standard ACL and extended ACL

面试唯品会实习测试岗、抖音实习测试岗【真实投稿】

AntiSamy:防 XSS 攻击的一种解决方案使用教程
随机推荐
2022上半年朋友圈都在传的10本书,找到了
Continuous test (CT) practical experience sharing
Sports Federation: resume offline sports events in a safe and orderly manner, and strive to do everything possible for domestic events
线程池的拒绝策略
Standard ACL and extended ACL
50亿,福建又诞生一只母基金
2022年推荐免费在线接收短信平台(国内、国外)
Datasimba launched wechat applet, and datanuza accepted the test of the whole scene| StartDT Hackathon
[Blue Bridge Cup training 100 questions] sort scratch from small to large. Blue Bridge Cup scratch competition special prediction programming question centralized training simulation exercise question
链式二叉树的基本操作(C语言实现)
静态路由配置
Recommend free online SMS receiving platform in 2022 (domestic and foreign)
完整的电商系统
99% of people don't know that privatized deployment is also a permanently free instant messaging software!
面试唯品会实习测试岗、抖音实习测试岗【真实投稿】
Creative changes brought about by the yuan universe
The moveposition function of rigidbody2d of unity2d solves the problem of people or screen jitter when moving
[Tawang methodology] Tawang 3W consumption strategy - U & a research method
6. About JWT
數據驗證框架 Apache BVal 再使用