当前位置:网站首页>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)
边栏推荐
- [information security laws and regulations] review
- The highest level of anonymity in C language
- Kubernetes DevOps CD工具对比选型
- Kirk borne's selection of learning resources this week [click the title to download directly]
- gsap动画库
- [C language] string function
- Short selling, overprinting and stock keeping, Oriental selection actually sold 2.66 million books in Tiktok in one month
- How to implement safety practice in software development stage
- 企业展厅设计中常用的三种多媒体技术形式
- 2022年推荐免费在线接收短信平台(国内、国外)
猜你喜欢
![Interview vipshop internship testing post, Tiktok internship testing post [true submission]](/img/69/b27255c303150430df467ff3b5cd08.gif)
Interview vipshop internship testing post, Tiktok internship testing post [true submission]
![Learn open62541 -- [67] add custom enum and display name](/img/98/e5e25af90b3f98c2be11d7d21e5ea6.png)
Learn open62541 -- [67] add custom enum and display name

Comparison and selection of kubernetes Devops CD Tools

Mathematical analysis_ Notes_ Chapter 11: Fourier series

标准ACL与扩展ACL

In 2021, the national average salary was released. Have you reached the standard?

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

【塔望方法论】塔望3W消费战略 - U&A研究法

AntiSamy:防 XSS 攻击的一种解决方案使用教程

行业案例|数字化经营底座助力寿险行业转型
随机推荐
How to implement safety practice in software development stage
Mathematical analysis_ Notes_ Chapter 11: Fourier series
Redis的发布与订阅
Nat address translation
企业MES制造执行系统的分类与应用
Learn open62541 -- [67] add custom enum and display name
基于图像和激光的多模态点云融合与视觉定位
Kubernetes DevOps CD工具对比选型
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%
清华、剑桥、UIC联合推出首个中文事实核查数据集:基于证据、涵盖医疗社会等多个领域
来了!GaussDB(for Cassandra)新特性亮相
unity2d的Rigidbody2D的MovePosition函数移动时人物或屏幕抖动问题解决
How many times is PTA 1101 B than a
嵌入式面试题(算法部分)
[C language] string function
PTA 1102 teaching Super Champion volume
IP netns command (memo)
Cadre de validation des données Apache bval réutilisé
【剑指 Offer】59 - I. 滑动窗口的最大值
线程池的拒绝策略