当前位置:网站首页>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)
边栏推荐
- Realize payment function in applet
- App capture of charles+drony
- I feel cheated. Wechat tests the function of "size number" internally, and two wechat can be registered with the same mobile number
- 【软件测试】从企业版BOSS直聘,看求职简历,你没被面上是有原因的
- 面试唯品会实习测试岗、抖音实习测试岗【真实投稿】
- [Tawang methodology] Tawang 3W consumption strategy - U & a research method
- [demo] circular queue and conditional lock realize the communication between goroutines
- 二叉树的基本概念和性质
- 低代码助力企业数字化转型会让程序员失业?
- [information security laws and regulations] review
猜你喜欢
Thread pool and singleton mode and file operation
Charles+Postern的APP抓包
The highest level of anonymity in C language
链式二叉树的基本操作(C语言实现)
CVPR 2022 - learning non target knowledge for semantic segmentation of small samples
Nat address translation
Cadre de validation des données Apache bval réutilisé
伺服力矩控制模式下的力矩目标值(fTorque)计算
[paper sharing] where's crypto?
清华、剑桥、UIC联合推出首个中文事实核查数据集:基于证据、涵盖医疗社会等多个领域
随机推荐
Redis
来了!GaussDB(for Cassandra)新特性亮相
How to choose the appropriate automated testing tools?
国内首次!这家中国企业的语言AI实力被公认全球No.2!仅次于谷歌
Reject policy of thread pool
低代码助力企业数字化转型会让程序员失业?
Cloud security daily 220707: Cisco Expressway series and telepresence video communication server have found remote attack vulnerabilities and need to be upgraded as soon as possible
能同时做三个分割任务的模型,性能和效率优于MaskFormer!Meta&UIUC提出通用分割模型,性能优于任务特定模型!开源!...
持续测试(CT)实战经验分享
CVPR 2022丨学习用于小样本语义分割的非目标知识
脑洞从何而来?加州大学最新研究:有创造力的人神经连接会「抄近道」
Usage of PHP interview questions foreach ($arr as $value) and foreach ($arr as $value)
How many times is PTA 1101 B than a
I feel cheated. Wechat tests the function of "size number" internally, and two wechat can be registered with the same mobile number
unity2d的Rigidbody2D的MovePosition函数移动时人物或屏幕抖动问题解决
SD_ DATA_ SEND_ SHIFT_ REGISTER
基于图像和激光的多模态点云融合与视觉定位
"Decryption" Huawei machine vision Corps: Huawei is moving up and the industry is moving forward
咋吃都不胖的朋友,Nature告诉你原因:是基因突变了
The highest level of anonymity in C language