当前位置:网站首页>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)
边栏推荐
- 抢占周杰伦
- String type, constant type and container type of go language
- The performance and efficiency of the model that can do three segmentation tasks at the same time is better than maskformer! Meta & UIUC proposes a general segmentation model with better performance t
- IP netns command (memo)
- 线程池中的线程工厂
- 体总:安全有序恢复线下体育赛事,力争做到国内赛事应办尽办
- Interview vipshop internship testing post, Tiktok internship testing post [true submission]
- 我感觉被骗了,微信内测 “大小号” 功能,同一手机号可注册两个微信
- 2022上半年朋友圈都在传的10本书,找到了
- POJ 2392 Space Elevator
猜你喜欢

Industry case | digital operation base helps the transformation of life insurance industry

How to choose the appropriate automated testing tools?

Kubernetes DevOps CD工具对比选型

6.关于jwt

The highest level of anonymity in C language

Do you know all four common cache modes?

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

微信网页调试8.0.19换掉X5内核,改用xweb,所以x5调试方式已经不能用了,现在有了解决方案
![[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](/img/08/5f4b4e2700606554516807c01454fd.png)
[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

DeSci:去中心化科学是Web3.0的新趋势?
随机推荐
I feel cheated. Wechat tests the function of "size number" internally, and two wechat can be registered with the same mobile number
AI来搞财富分配比人更公平?来自DeepMind的多人博弈游戏研究
SD_ DATA_ RECEIVE_ SHIFT_ REGISTER
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
[unity shader] insert pass to realize the X-ray perspective effect of model occlusion
How to choose the appropriate automated testing tools?
虚拟数字人里的生意经
Thread pool and singleton mode and file operation
企业MES制造执行系统的分类与应用
Realize payment function in applet
Three forms of multimedia technology commonly used in enterprise exhibition hall design
Continuous test (CT) practical experience sharing
脑洞从何而来?加州大学最新研究:有创造力的人神经连接会「抄近道」
PTA 1102 教超冠军卷
基于图像和激光的多模态点云融合与视觉定位
Redis publishing and subscription
Basic concepts and properties of binary tree
Yunjing network technology interview question [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]
Wireshark analyzes packet capture data * cap
App capture of charles+drony