编程题:25
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String num = scanner.next();
String[] pinyin = {"ling", "yi", "er", "san", "si", "wu", "liu", "qi", "ba", "jiu"};
StringBuilder result = new StringBuilder();
if (num.startsWith("-")) {
result.append("fu ");
num = num.substring(1);
}
for (int i = 0; i < num.length(); i++) {
int digit = num.charAt(i) - '0';
result.append(pinyin[digit]);
if (i != num.length() - 1) {
result.append(" ");
}
}
System.out.println(result);
}
}

posted on 2025-05-12 23:25  Swishy  阅读(4)  评论(0)    收藏  举报