当前位置:网站首页>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)
边栏推荐
- [sword finger offer] 59 - I. maximum value of sliding window
- Wireshark analyzes packet capture data * cap
- 来了!GaussDB(for Cassandra)新特性亮相
- RISCV64
- 线程池中的线程工厂
- Charles+drony的APP抓包
- 国内的软件测试会受到偏见吗
- gsap动画库
- 单臂路由和三层交换的简单配置
- 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
猜你喜欢

A hodgepodge of ICER knowledge points (attached with a large number of topics, which are constantly being updated)

线程池和单例模式以及文件操作

Will low code help enterprises' digital transformation make programmers unemployed?

Reinforcement learning - learning notes 8 | Q-learning

Three forms of multimedia technology commonly used in enterprise exhibition hall design

Kirk Borne的本周学习资源精选【点击标题直接下载】

6.关于jwt

Simple configuration of single arm routing and layer 3 switching

Nat address translation

Review of network attack and defense
随机推荐
10 schemes to ensure interface data security
Thread pool and singleton mode and file operation
A hodgepodge of ICER knowledge points (attached with a large number of topics, which are constantly being updated)
【MIME笔记】
手把手教姐姐写消息队列
Short selling, overprinting and stock keeping, Oriental selection actually sold 2.66 million books in Tiktok in one month
清华、剑桥、UIC联合推出首个中文事实核查数据集:基于证据、涵盖医疗社会等多个领域
国内的软件测试会受到偏见吗
Wireshark分析抓包数据*.cap
DataSimba推出微信小程序,DataNuza接受全场景考验? | StartDT Hackathon
POJ 1182 :食物链(并查集)[通俗易懂]
Nunjuks template engine
Basic operation of chain binary tree (implemented in C language)
SD_ DATA_ SEND_ SHIFT_ REGISTER
SQLite SQL exception near "with": syntax error
[C language] string function
单臂路由和三层交换的简单配置
线程池的拒绝策略
2022-07-04 matlab读取视频帧并保存
Do you know all four common cache modes?