import java.util.Scanner;
public class Main {
static String[] times1 = { "zero", "one", "two", "three", "four", "five",
"six", "seven", "eight", "nine", "ten", "eleven", "twelve",
"thirteen", "fourteen", "fifteen", "sixteen", "seventeen",
"eighteen", "nineteen", "twenty" };
static String[] times2 = { "0", "0", "twenty", "thirty", "forty", "fifty" };
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
int h = scanner.nextInt();
int m = scanner.nextInt();
if (h > 20) {
int a = h / 10;
int b = h % 10;
System.out.print(times2[a] + " " + times1[b] + " ");
} else {
System.out.print(times1[h] + " ");
}
if (m == 0) {
System.out.println("o'clock");
} else if (m > 20) {
int a = m / 10;
int b = m % 10;
System.out.println(times2[a] + " " + times1[b]);
} else {
System.out.println(times1[m]);
}
}
}
}
[BASIC-26] 报时助手,布布扣,bubuko.com
原文地址:http://blog.csdn.net/u011506951/article/details/26703603