解题思路:
注意事项:
参考代码:
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 人评分
K-进制数 (C++代码)浏览:855 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:659 |
C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:663 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:934 |
简单的a+b (C语言代码)浏览:537 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:578 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:1301 |
Hello, world! (C++代码)浏览:1744 |
【偶数求和】 (C语言代码)浏览:431 |
C语言程序设计教程(第三版)课后习题8.4 (C语言代码)浏览:553 |