当前位置:网站首页>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] + " ");
}
}
}
}
结果:
边栏推荐
猜你喜欢
技能在赛题解析:交换机防环路设置
1002 写出这个数 (20 分)
1081 检查密码 (15 分)
TF通过feature与label生成(特征,标签)集合,tf.data.Dataset.from_tensor_slices
关于Excel实现分组求和最全文档
STM32CUBEIDE(11)----输出PWM及修改PWM频率与占空比
接口测试的基础流程和用例设计方法你知道吗?
1106 2019数列 (15 分)
tf.cast(),reduce_min(),reduce_max()
Implementation of FIR filter based on FPGA (5) - FPGA code implementation of parallel structure FIR filter
随机推荐
基于FPGA的FIR滤波器的实现(5)— 并行结构FIR滤波器的FPGA代码实现
1081 检查密码 (15 分)
MySQL使用GROUP BY 分组查询时,SELECT 查询字段包含非分组字段
Douyin API interface
博途PLC 1200/1500PLC ModbusTcp通信梯形图优化汇总(多服务器多从站轮询)
求职简历这样写,轻松搞定面试官
【推荐系统】:协同过滤和基于内容过滤概述
Trill keyword search goods - API
1056 组合数的和 (15 分)
机器学习总结(二)
JD.com product details API call example explanation
伦敦银规则有哪些?
1046 划拳 (15 分)
年薪40W测试工程师成长之路,你在哪个阶段?
关于Excel实现分组求和最全文档
公牛10-11德里克·罗斯最强赛季记录
NTT的Another Me技术助力创造歌舞伎演员中村狮童的数字孪生体,将在 “Cho Kabuki 2022 Powered by NTT”舞台剧中首次亮相
Unity开发者必备的C#脚本技巧
opencv实现数据增强(图片+标签)平移,翻转,缩放,旋转
NFT 的价值从何而来