1082 Read Number in Chinese (25 分)
Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output Fufirst if it is negative. For example, -123456789 is read as Fu yi Yi er Qian san Bai si Shi wu Wan liu Qian qi Bai ba Shi jiu. Note: zero (ling) must be handled correctly according to the Chinese tradition. For example, 100800 is yi Shi Wan ling ba Bai.
Input Specification:
Each input file contains one test case, which gives an integer with no more than 9 digits.
Output Specification:
For each test case, print in a line the Chinese way of reading the number. The characters are separated by a space and there must be no extra space at the end of the line.
Sample Input 1:
-123456789
Sample Output 1:
Fu yi Yi er Qian san Bai si Shi wu Wan liu Qian qi Bai ba Shi jiu
Sample Input 2:
100800
Sample Output 2:
yi Shi Wan ling ba Bai
分析: 这个题有点复杂。。慢慢模拟。。debug了好久,要注意一个数中间空了多个零,只要输出一个零。。。
一开始没注意,女朋友随便给我出了个数。。竟然真错在这里了,她是不是有干测试的潜质= =
/**
* Copyright(c)
* All rights reserved.
* Author : Mered1th
* Date : 2019-02-24-22.11.37
* Description : A1082
*/
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<unordered_set>
#include<map>
#include<vector>
#include<set>
using namespace std;
]={"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};
]={"Yi","Wan"};
void func(int n){
string s=to_string(n);
){
cout<<num[s[]-'];
}
){
cout<<num[s[]-']<<" "<<"Shi";
]!='){
cout<<]-'];
}
}
){
cout<<num[s[]-']<<" "<<"Bai";
]=='){
]!='){
cout<<]-'];
}
}
else{
cout<<]-']<<" Shi";
]!='){
cout<<]-'];
}
}
}
){
cout<<num[s[]-']<<" Qian";
]=='){
]=='){
]!='){
cout<<]-'];
}
}
else{
cout<<]-']<<" Shi";
]!='){
cout<<]-'];
}
}
}
else{
cout<<]-']<<" Bai";
]=='){
]!='){
cout<<]-'];
}
}
else{
cout<<]-']<<" Shi";
]!='){
cout<<]-'];
}
}
}
}
}
int main(){
#ifdef ONLINE_JUDGE
#else
freopen("1.txt", "r", stdin);
#endif
int s;
cin>>s;
){
printf("ling");
;
}
){
printf("Fu ");
s=-s;
}
;
/;
;
bool flag=false;
if(s1){
func(s1);
cout<<]<<" ";
}
if(s2){
string t2=to_string(s2);
){
;i<=t2.size();i++){
'){
cout<<"ling ";
}
}
}
func(s2);
cout<<]<<" ";
}
if(s3){
&& s2==){
cout<<"ling ";
flag=true;
}
string t3=to_string(s3);
){
;i<=t3.size();i++){
' && flag==false){
cout<<"ling ";
flag=true;
}
}
}
func(s3);
}
;
}
1082 Read Number in Chinese (25 分)的更多相关文章
- 1082 Read Number in Chinese (25分)
// 1082.cpp : 定义控制台应用程序的入口点. // #include <iostream> #include <string> #include <vecto ...
- 【PAT甲级】1082 Read Number in Chinese (25 分)
题意: 输入一个九位整数,输出它的汉字读法(用拼音表示). trick: 字符串数组""其实会输出一个空格,而不是什么都不输出,导致测试点0和4格式错误. AAAAAccepted ...
- A1082 Read Number in Chinese (25 分)
1082 Read Number in Chinese (25 分) Given an integer with no more than 9 digits, you are supposed t ...
- 1082. Read Number in Chinese (25)
题目如下: Given an integer with no more than 9 digits, you are supposed to read it in the traditional Ch ...
- 1082. Read Number in Chinese (25)-字符串处理
题意就是给出9位以内的数字,按照汉子的读法读出来. 读法请看下方的几个例子: 5 0505 0505 伍亿零伍佰零伍万零伍佰零伍 5 5050 5050 伍亿伍仟零伍拾万伍仟零伍拾 (原本我以为这个 ...
- PAT (Advanced Level) 1082. Read Number in Chinese (25)
模拟题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
- pat1082. Read Number in Chinese (25)
1082. Read Number in Chinese (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...
- A1082 Read Number in Chinese (25)(25 分)
A1082 Read Number in Chinese (25)(25 分) Given an integer with no more than 9 digits, you are suppose ...
- PAT 1082 Read Number in Chinese[难]
1082 Read Number in Chinese (25 分) Given an integer with no more than 9 digits, you are supposed to ...
随机推荐
- influxdb基本操作
名词解释 在具体的讲解influxdb的相关操作之前先说说influxdb的一些专有名词,这些名词代表什么. influxDB名词 database:数据库: measurement:数据库中的表: ...
- Python集成开发环境搭建
===================== 开始学习Python的开发,首先得搭建好集成开发的环境! 分为下面几个步骤: 操作系统平台:Windows XP/7/10 都可以 1.安装并配置JDK运行 ...
- (2)bytes类型
bytes类型就是字节类型 把8个二进制一组称为一个byte,用16进制来表示 Python2里面字符串其实更应该称为字节串,但是python2里面有一个类型是butes,所以在Python2里面by ...
- 【idea】如何将idea的项目路径设置成代码目录和配置文件目录
一:创建相应的目录 二.提升目录的等级
- LG1801 【黑匣子_NOI导刊2010提高(06)】
看到各路dalao用平衡树的做法,表示本人不才,并不会. 然而我会优先队列_huaji_,并且发现用堆解题的dalao们并没有基于在线的做法 于是我的showtime到了 评测结果:https://w ...
- day37 mysql数据库学习
3.什么是数据库 用来存储数据的仓库 数据是以文件的形式保存 海峰补充内容 ↓ 4 数据库服务器.数据管理系统.数据库.表与记录的关系(重点理解!!!) 记录:1 刘海龙 324245234 2 ...
- error MSB3073: 命令“regsvr32 /s /c:VCEnd”已退出,代码为 3
版权声明:博客地址:blog.csdn.net/x356982611,未经同意不得转载,不得转载,不得转载 https://blog.csdn.net/x356982611/article/detai ...
- C# 中的应用配置
配置功能是软件必要的功能,下面介绍以下 Glacier 内置的配置框架,Glacier 支持三种方式的配置: appSettings 配置 嵌入的 HOCON 配置 独立的 HOCON 配置 优先级: ...
- 理解git
为了真正了解git,我们从底部.底层开始,了解git核心,知其然并知其所以然. 为什么要进行版本控制呢? 因为编写文件不可能一次到位,文件总是有不同的状态需要保存下来,方便以后出错回滚. git 是目 ...
- 嵌入式QT程序的汉字显示
因底层服务程序全是GBK格式的,所以QT程序要全部更改编码方式. 1.QT程序编码更改 creator->edit->更改编码方式GBK main程序中做如下修改,并注意语句次序 int ...