当前位置:网站首页>1002 写出这个数 (20 分)
1002 写出这个数 (20 分)
2022-08-11 06:45:00 【呆比特】
题目要求:
代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//輸入接收
String str = scan.nextLine();
//提前定义数字与拼音的对应关系
String result[] = {
"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};
//和
int sum = 0;
//求輸入每位和
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] + " ");
}
}
}
}
结果:
边栏推荐
- Daily SQL - find each of the students school gpa minimum (window)
- daily sql - user retention rate for two days
- Amazon API interface Daquan
- Daily sql--statistics the total salary of employees in the past three months (excluding the latest month)
- MySQL 版本升级心得
- 结合均线分析k线图的基本知识
- 那些事情是用Unity开发项目应该一开始规划好的?如何避免后期酿成巨坑?
- Unity3D learning route?
- 详述 MIMIC护理人员信息表(十五)
- 6月各手机银行活跃用户较快增长,创半年新高
猜你喜欢
Taobao API interface reference
TF中的One-hot
6月各手机银行活跃用户较快增长,创半年新高
Taobao API common interface and acquisition method
技能在赛题解析:交换机防环路设置
SQL滑动窗口
ROS 话题通信理论模型
radix-4 FFT principle and C language code implementation
Get Pinduoduo product information operation details
Multiscale communication in cortical-cortical networks
随机推荐
Service的两种状态形式
Daily sql--statistics the total salary of employees in the past three months (excluding the latest month)
【sdx62】XBL设置共享内存变量,然后内核层获取变量实现
Implementation of FIR filter based on FPGA (5) - FPGA code implementation of parallel structure FIR filter
Edge 提供了标签分组功能
2021-08-11 for循环结合多线程异步查询并收集结果
结合均线分析k线图的基本知识
【预约观看】Ambire 智能钱包 AMA 活动第四期即将举行
Internet phone software or consolidation of attack must be "free" calls security clearance
sql--Users who have purchased more than 3 times (inclusive) within 7 days (including the current day), and the purchase amount in the past 7 days exceeds 1,000
李沐d2l(十)--卷积层Ⅰ
国密规范 SM2 SM3 SM4
常见激活函数及其导数
matplotlib
Douyin API interface
深度监督(中继监督)
break pad源码编译--参考大佬博客的总结
LeetCode brushing series -- 46. Full arrangement
NTT的Another Me技术助力创造歌舞伎演员中村狮童的数字孪生体,将在 “Cho Kabuki 2022 Powered by NTT”舞台剧中首次亮相
易观分析联合中小银行联盟发布海南数字经济指数,敬请期待!