解题思路:
注意事项:
参考代码:
import java.util.HashMap; import java.util.Scanner; public class T1468 { public static void main(String[] args) { Scanner in = new Scanner(System.in); HashMap<Integer,String> map = new HashMap<>(); String digit[] = {"zero","one","two","three","four","five","six","seven", "eight","nine","ten","eleven","twelve","thirteen","fourteen", "fifteen","sixteen","seventeen","eighteen","nineteen", "twenty","twenty one","twenty two","twenty three"}; for(int i = 0;i<=23;i++) map.put(i, digit[i]); map.put(30, "thirty"); map.put(40, "forty"); map.put(50, "fifty"); while(in.hasNext()) { int h = in.nextInt(),m = in.nextInt(); String ans = ""; if(m == 0) { ans = map.get(h)+" o'clock"; } else if(0<m&&m<=20 || m%10==0){ ans = map.get(h) +" "+ map.get(m); } else { ans = map.get(h)+" "+map.get(m/10*10)+" "+map.get(m%10); } System.out.println(ans); } in.close(); } }
0.0分
2 人评分
C语言程序设计教程(第三版)课后习题8.9 (C语言代码)浏览:690 |
简单的a+b (C语言代码)浏览:564 |
C语言程序设计教程(第三版)课后习题6.8 (C语言代码)浏览:798 |
C语言程序设计教程(第三版)课后习题7.5 (C语言代码)浏览:900 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:1110 |
WU-格式化数据输出 (C++代码)浏览:1312 |
三角形 (C++代码)递推浏览:825 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:903 |
1124题解浏览:630 |
The 3n + 1 problem (C语言代码)浏览:550 |