解题思路:
读懂题意,字典+判断+拼接,小白级别写法。
参考代码:
times = {0:"zero",1:"one",2:"two",3:"three",4:"four",5:"five",6:"six", 7:"seven",8:"eight",9:"nine",10:"ten",11:"eleven", 12:"twelve",13:"thirteen",14:"fourteen",15:"fifteen", 16:"sixteen",17:"seventeen",18:"eighteen",19:"nineteen",20:"twenty", 30:"thirty",40:"forty",50:"fifty"} h,m = map(int,input().split()) time = "" #时的判断 if h > 20: s = h%10 time += times.get(h-s) + " " + times.get(s)+" " else: time += times.get(h)+" " #分的判断 if m == 0: time += "o'clock" elif m > 20: s = m%10 time += times.get(m-s) + " "+ times.get(s) else: time += times.get(m) print(time)
0.0分
6 人评分
C语言训练-求具有abcd=(ab+cd)2性质的四位数 (C语言代码)浏览:619 |
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:563 |
大神老白 (C语言代码)浏览:690 |
哥德巴赫曾猜测 (C语言代码)浏览:2560 |
C语言程序设计教程(第三版)课后习题6.2 (C语言代码)浏览:716 |
简单的a+b (C语言代码)浏览:529 |
C语言程序设计教程(第三版)课后习题9.4 (C语言代码)浏览:724 |
C二级辅导-分段函数 (C语言代码)浏览:659 |
2006年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:383 |
矩形面积交 (C语言代码)浏览:1433 |