当前位置:网站首页>1002 Write the number (20 points)
1002 Write the number (20 points)
2022-08-11 07:47:00 【dumb bit】
题目要求:
代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//input receive
String str = scan.nextLine();
//Define the correspondence between numbers and pinyin in advance
String result[] = {
"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};
//和
int sum = 0;
//Please enter the sum of each bit
String[] strs = str.split("");
for (int i = 0; i < str.length(); i++) {
sum += Integer.valueOf(strs[i]);
}
//对应输出
for (int i = 0; i < (sum + "").length(); i++) {
int index = Integer.valueOf((sum + "").split("")[i]);
if (i == (sum + "").length() - 1){
System.out.print(result[index]);
} else{
System.out.print(result[index] + " ");
}
}
}
}
结果:
边栏推荐
猜你喜欢
随机推荐
MindManager2022全新正式免费思维导图更新
伦敦银规则有哪些?
tf.reduce_mean()与tf.reduce_sum()
计算YUV文件的PSNR与SSIM
ROS 话题通信理论模型
关于Excel实现分组求和最全文档
动态代理学习
Edge 提供了标签分组功能
Daily sql--statistics the total salary of employees in the past three months (excluding the latest month)
Depth (relay supervision)
unable to extend table xxx by 1024 in tablespace xxxx
mysql视图与索引
6月各手机银行活跃用户较快增长,创半年新高
1051 复数乘法 (15 分)
详述MIMIC 的ICU患者检测时间信息表(十六)
李沐d2l(十)--卷积层Ⅰ
关于Android Service服务的面试题
国密规范 SM2 SM3 SM4
2022年中国软饮料市场洞察
进制转换间的那点事