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 分)的更多相关文章

  1. 1082 Read Number in Chinese (25分)

    // 1082.cpp : 定义控制台应用程序的入口点. // #include <iostream> #include <string> #include <vecto ...

  2. 【PAT甲级】1082 Read Number in Chinese (25 分)

    题意: 输入一个九位整数,输出它的汉字读法(用拼音表示). trick: 字符串数组""其实会输出一个空格,而不是什么都不输出,导致测试点0和4格式错误. AAAAAccepted ...

  3. 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 ...

  4. 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 ...

  5. 1082. Read Number in Chinese (25)-字符串处理

    题意就是给出9位以内的数字,按照汉子的读法读出来. 读法请看下方的几个例子: 5 0505 0505 伍亿零伍佰零伍万零伍佰零伍 5 5050 5050 伍亿伍仟零伍拾万伍仟零伍拾  (原本我以为这个 ...

  6. PAT (Advanced Level) 1082. Read Number in Chinese (25)

    模拟题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

  7. pat1082. Read Number in Chinese (25)

    1082. Read Number in Chinese (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. session进行增删改查操作

    一般将针对数据库的操作放在事物里面, 开始事物:session.beginTransaction(); 获取事物:session.getTransaction(); 提交事物:transaction. ...

  2. Femtocell家庭基站通信截获、伪造任意短信漏洞

    阿里移动安全团队与中国泰尔实验室无线技术部的通信专家们一起,联合对国内运营商某型Femtocell基站进行了安全分析,发现多枚重大漏洞,可导致用户的短信.通话.数据流量被窃听.恶意攻击者可以在免费申领 ...

  3. Redis----windows下的常用命令

    1:首先下载redis.从下面地址下:https://github.com/MSOpenTech/redis/releases2:创建redis.conf文件:这是一个配置文件,指定了redis的监听 ...

  4. QList 列表指针的 释放

    1,使用qDeleteAll() QList<T*> list: qDeleteAll(list): list = NULL; QList<T*> *listp: qDelet ...

  5. 2.3 linux中的信号分析 阻塞、未达

    信号的阻塞.未达: linux中进程1向进程2发送信号,要经过内核,内核会维护一个进程对某个信号的状态,如下图所示: 当进程1向进程2发送信号时,信号的传递过程在内核中是有状态的,内核首先要检查这个信 ...

  6. pycharm中tensorflow代码不能自动补全或import红线问题解决

    正确安装并配置好pycharm+tensorflow环境之后,可能在pycharm中导入tensorflow会有以下问题: 1. " import tensorflow as tf &quo ...

  7. python可视化爬虫实现“京东试用”批量申请

    介绍: 环境:chromedriver 2.41.578700+ selenuim3.14.0 过程: 1.打开京东主页 2.登录京东 3.打开京东试用页面 4.获取商品列表 5.自动申请试用(该商品 ...

  8. 【python基础】如何注释代码块

    前言 编写python程序有时候需要对代码块进行comment,本文对此介绍. 方法 python注释的三种方法: 1.井号注释单行代码: # 2.三个单引号或三个双引号注释语句块: ''' 或者&q ...

  9. 在 Roslyn 分析语法树时添加条件编译符号的支持

    我们在代码中会写 #if DEBUG 或者 [Conditional("DEBUG")] 来使用已经定义好的条件编译符号.而定义条件编译符号可以在代码中使用 #define WAL ...

  10. CTF-练习平台-Misc之 再来一道隐写

    十二.再来一道隐写 下载文件后打开,用常用的几个方法都没有找到有用的信息,然后观察图片发现搞度有点低,所以用WinHex打开把图片高度改大,保存.再次打开图片发现flag